Files
openlayers/examples/xyz-esri-4326-512.js
Frederic Junod 4a3f70c09b Revert "Simplify import path in examples"
This reverts commit 79c8afdba8.
2018-11-27 16:49:55 +01:00

37 lines
1010 B
JavaScript

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