1 | goog.require('ol.Map');
|
2 | goog.require('ol.View');
|
3 | goog.require('ol.extent');
|
4 | goog.require('ol.layer.Image');
|
5 | goog.require('ol.layer.Tile');
|
6 | goog.require('ol.proj');
|
7 | goog.require('ol.source.ImageStatic');
|
8 | goog.require('ol.source.OSM');
|
9 |
|
10 |
|
11 | proj4.defs('EPSG:27700', '+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 ' +
|
12 | '+x_0=400000 +y_0=-100000 +ellps=airy ' +
|
13 | '+towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 ' +
|
14 | '+units=m +no_defs');
|
15 | var imageExtent = [0, 0, 700000, 1300000];
|
16 |
|
17 | var map = new ol.Map({
|
18 | layers: [
|
19 | new ol.layer.Tile({
|
20 | source: new ol.source.OSM()
|
21 | }),
|
22 | new ol.layer.Image({
|
23 | source: new ol.source.ImageStatic({
|
24 | url: 'https://upload.wikimedia.org/wikipedia/commons/thumb/1/18/' +
|
25 | 'British_National_Grid.svg/2000px-British_National_Grid.svg.png',
|
26 | crossOrigin: '',
|
27 | projection: 'EPSG:27700',
|
28 | imageExtent: imageExtent
|
29 | })
|
30 | })
|
31 | ],
|
32 | target: 'map',
|
33 | view: new ol.View({
|
34 | center: ol.proj.transform(
|
35 | ol.extent.getCenter(imageExtent), 'EPSG:27700', 'EPSG:3857'),
|
36 | zoom: 4
|
37 | })
|
38 | });
|