|
7 | 7 | type="text/css"
|
8 | 8 | href="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io/en/v6.4.3/css/ol.css"
|
9 | 9 | />
|
10 |
| - <link rel=" stylesheet" href=" https://unpkg.com/[email protected]/dist/mapbox-gl.css" > |
| 10 | + <link |
| 11 | + rel="stylesheet" |
| 12 | + href=" https://unpkg.com/[email protected]/dist/mapbox-gl.css" |
| 13 | + /> |
11 | 14 | <meta charset="utf-8" />
|
12 | 15 | </head>
|
13 | 16 | <body>
|
|
32 | 35 | <div id="promo-text">Join the team!</div>
|
33 | 36 | </a>
|
34 | 37 | </div>
|
35 |
| - <div id="copyrightDiv"> |
36 |
| - © OpenStreetMap contributors © Mapbox |
37 |
| - </div> |
| 38 | + <div id="copyrightDiv">© OpenStreetMap contributors © Mapbox</div> |
38 | 39 | </div>
|
39 | 40 | <script type="text/javascript">
|
40 |
| - |
41 | 41 | var editLayer = new ol.layer.Vector({
|
42 | 42 | source: new ol.source.Vector({
|
43 |
| - wrapX: false |
44 |
| - }) |
| 43 | + wrapX: false, |
| 44 | + }), |
45 | 45 | });
|
46 | 46 |
|
47 | 47 | // Code taken from https://openlayers.org/en/latest/examples/mapbox-layer.html
|
48 | 48 | var mbMap = new mapboxgl.Map({
|
49 | 49 | container: 'map',
|
50 |
| - center: ol.proj.toLonLat([873708.375917, 6105425.847789]), |
| 50 | + center: ol.proj.toLonLat([873708.375917, 6105425.847789]), |
51 | 51 | attributionControl: false,
|
52 | 52 | interactive: false,
|
53 | 53 | });
|
54 |
| - |
| 54 | + |
55 | 55 | // Get the public api key
|
56 | 56 | fetch('https://backend.developer.geops.io/publickey')
|
57 | 57 | .then((response) => response.json())
|
58 |
| - .then(function(data = {}) { |
59 |
| - mbMap.setStyle('https://maps.geops.io/styles/travic_v2/style.json?key=' + data.key) |
60 |
| - }); |
| 58 | + .then(function (data = {}) { |
| 59 | + mbMap.setStyle( |
| 60 | + 'https://maps.geops.io/styles/travic_v2/style.json?key=' + data.key, |
| 61 | + ); |
| 62 | + }); |
61 | 63 |
|
62 | 64 | // Code taken from https://openlayers.org/en/latest/examples/mapbox-layer.html
|
63 | 65 | var mbLayer = new ol.layer.Layer({
|
|
87 | 89 | });
|
88 | 90 |
|
89 | 91 | var map = new ol.Map({
|
90 |
| - layers: [ |
91 |
| - mbLayer, |
92 |
| - editLayer, |
93 |
| - ], |
94 |
| - target: "map", |
| 92 | + layers: [mbLayer, editLayer], |
| 93 | + target: 'map', |
95 | 94 | view: new ol.View({
|
96 | 95 | center: [873708.375917, 6105425.847789],
|
97 |
| - zoom: 15 |
| 96 | + zoom: 15, |
98 | 97 | }),
|
99 |
| - keyboardEventTarget: document |
| 98 | + keyboardEventTarget: document, |
100 | 99 | });
|
101 | 100 |
|
102 | 101 | var editor = new ole.Editor(map);
|
103 | 102 |
|
104 | 103 | var cad = new ole.control.CAD({
|
105 |
| - source: editLayer.getSource() |
| 104 | + source: editLayer.getSource(), |
106 | 105 | });
|
107 | 106 |
|
108 | 107 | var draw = new ole.control.Draw({
|
109 |
| - source: editLayer.getSource() |
| 108 | + source: editLayer.getSource(), |
110 | 109 | });
|
111 | 110 |
|
112 | 111 | var drawLine = new ole.control.Draw({
|
113 |
| - type: "LineString", |
114 |
| - source: editLayer.getSource() |
| 112 | + type: 'LineString', |
| 113 | + source: editLayer.getSource(), |
115 | 114 | });
|
116 | 115 |
|
117 | 116 | var rotate = new ole.control.Rotate({
|
118 |
| - source: editLayer.getSource() |
| 117 | + source: editLayer.getSource(), |
119 | 118 | });
|
120 | 119 |
|
121 | 120 | var drawPoly = new ole.control.Draw({
|
122 |
| - type: "Polygon", |
123 |
| - source: editLayer.getSource() |
| 121 | + type: 'Polygon', |
| 122 | + source: editLayer.getSource(), |
124 | 123 | });
|
125 | 124 |
|
126 | 125 | var modify = new ole.control.Modify({
|
127 | 126 | source: editLayer.getSource(),
|
128 | 127 | });
|
129 | 128 |
|
130 | 129 | var buffer = new ole.control.Buffer({
|
131 |
| - source: editLayer.getSource() |
| 130 | + source: editLayer.getSource(), |
132 | 131 | });
|
133 | 132 |
|
134 | 133 | var union = new ole.control.Union({
|
135 |
| - source: editLayer.getSource() |
| 134 | + source: editLayer.getSource(), |
136 | 135 | });
|
137 | 136 |
|
138 | 137 | var intersection = new ole.control.Intersection({
|
139 |
| - source: editLayer.getSource() |
| 138 | + source: editLayer.getSource(), |
140 | 139 | });
|
141 | 140 |
|
142 | 141 | var difference = new ole.control.Difference({
|
143 |
| - source: editLayer.getSource() |
| 142 | + source: editLayer.getSource(), |
144 | 143 | });
|
145 | 144 |
|
146 | 145 | editor.addControls([
|
|
153 | 152 | buffer,
|
154 | 153 | union,
|
155 | 154 | intersection,
|
156 |
| - difference |
| 155 | + difference, |
157 | 156 | ]);
|
158 | 157 |
|
159 | 158 | var ls = new ole.service.LocalStorage();
|
|
0 commit comments