Files
openlayers/examples/xyz-esri-4326-512.js
Tim Schaub 7f47883c48 Transformed
2017-12-12 06:53:18 -07:00

40 lines
1.1 KiB
JavaScript

import _ol_Map_ from '../src/ol/Map.js';
import _ol_View_ from '../src/ol/View.js';
import _ol_layer_Tile_ from '../src/ol/layer/Tile.js';
import _ol_proj_ from '../src/ol/proj.js';
import _ol_source_XYZ_ from '../src/ol/source/XYZ.js';
var projection = _ol_proj_.get('EPSG:4326');
// The tile size supported by the ArcGIS tile service.
var tileSize = 512;
var urlTemplate = 'https://services.arcgisonline.com/arcgis/rest/services/' +
'ESRI_Imagery_World_2D/MapServer/tile/{z}/{y}/{x}';
var map = new _ol_Map_({
target: 'map',
layers: [
new _ol_layer_Tile_({
source: new _ol_source_XYZ_({
attributions: 'Copyright:© 2013 ESRI, i-cubed, GeoEye',
maxZoom: 16,
projection: projection,
tileSize: tileSize,
tileUrlFunction: function(tileCoord) {
return urlTemplate.replace('{z}', (tileCoord[0] - 1).toString())
.replace('{x}', tileCoord[1].toString())
.replace('{y}', (-tileCoord[2] - 1).toString());
},
wrapX: true
})
})
],
view: new _ol_View_({
center: [0, 0],
projection: projection,
zoom: 2,
minZoom: 2
})
});