UNPKG

770 BJavaScriptView Raw
1goog.require('ol.Graticule');
2goog.require('ol.Map');
3goog.require('ol.View');
4goog.require('ol.layer.Tile');
5goog.require('ol.proj');
6goog.require('ol.source.OSM');
7goog.require('ol.style.Stroke');
8
9
10var map = new ol.Map({
11 layers: [
12 new ol.layer.Tile({
13 source: new ol.source.OSM({
14 wrapX: false
15 })
16 })
17 ],
18 target: 'map',
19 view: new ol.View({
20 center: ol.proj.fromLonLat([4.8, 47.75]),
21 extent: ol.proj.get('EPSG:3857').getExtent(),
22 zoom: 5
23 })
24});
25
26// Create the graticule component
27var graticule = new ol.Graticule({
28 // the style to use for the lines, optional.
29 strokeStyle: new ol.style.Stroke({
30 color: 'rgba(255,120,0,0.9)',
31 width: 2,
32 lineDash: [0.5, 4]
33 }),
34 showLabels: true
35});
36
37graticule.setMap(map);