UNPKG

731 BJavaScriptView Raw
1goog.require('ol.Attribution');
2goog.require('ol.Map');
3goog.require('ol.View');
4goog.require('ol.layer.Tile');
5goog.require('ol.proj');
6goog.require('ol.source.XYZ');
7
8
9var attribution = new ol.Attribution({
10 html: 'Tiles © <a href="https://services.arcgisonline.com/ArcGIS/' +
11 'rest/services/World_Topo_Map/MapServer">ArcGIS</a>'
12});
13
14var map = new ol.Map({
15 target: 'map',
16 layers: [
17 new ol.layer.Tile({
18 source: new ol.source.XYZ({
19 attributions: [attribution],
20 url: 'https://server.arcgisonline.com/ArcGIS/rest/services/' +
21 'World_Topo_Map/MapServer/tile/{z}/{y}/{x}'
22 })
23 })
24 ],
25 view: new ol.View({
26 center: ol.proj.fromLonLat([-121.1, 47.5]),
27 zoom: 7
28 })
29});