To have the same path (starting with `ol/`, without `.js`) as in the documentation. The support was added in the webpack config in #8928
25 lines
639 B
JavaScript
25 lines
639 B
JavaScript
import Map from 'ol/Map';
|
|
import View from 'ol/View';
|
|
import TileLayer from 'ol/layer/Tile';
|
|
import {fromLonLat} from 'ol/proj';
|
|
import XYZ from 'ol/source/XYZ';
|
|
|
|
|
|
const map = new Map({
|
|
target: 'map',
|
|
layers: [
|
|
new TileLayer({
|
|
source: new XYZ({
|
|
attributions: 'Tiles © <a href="https://services.arcgisonline.com/ArcGIS/' +
|
|
'rest/services/World_Topo_Map/MapServer">ArcGIS</a>',
|
|
url: 'https://server.arcgisonline.com/ArcGIS/rest/services/' +
|
|
'World_Topo_Map/MapServer/tile/{z}/{y}/{x}'
|
|
})
|
|
})
|
|
],
|
|
view: new View({
|
|
center: fromLonLat([-121.1, 47.5]),
|
|
zoom: 7
|
|
})
|
|
});
|