|
1 | 1 | <!DOCTYPE html>
|
2 | 2 | <html>
|
3 |
| - |
4 | 3 | <head>
|
5 | 4 | <title>Mapbox GL JS debug page</title>
|
6 | 5 | <meta charset='utf-8'>
|
7 | 6 | <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
8 | 7 | <link rel='stylesheet' href='/dist/mapbox-gl.css' />
|
9 | 8 | <style>
|
10 |
| - body { |
11 |
| - margin: 0; |
12 |
| - padding: 0; |
13 |
| - } |
14 |
| - |
15 |
| - #map { |
16 |
| - position: absolute; |
17 |
| - height: 100%; |
18 |
| - left:0; |
19 |
| - right:0; |
20 |
| - } |
21 |
| - |
22 |
| - #sidebar { |
23 |
| - width: 200px; |
24 |
| - position: absolute; |
25 |
| - top:0; |
26 |
| - left:0; |
27 |
| - height: 100%; |
28 |
| - background-color: white; |
29 |
| - opacity: .3; |
30 |
| - z-index: 99; |
31 |
| - } |
| 9 | + body { margin: 0; padding: 0; } |
| 10 | + html, body, #map { height: 100%; } |
32 | 11 | </style>
|
33 | 12 | </head>
|
34 | 13 |
|
35 | 14 | <body>
|
36 |
| - <div id='map'></div> |
37 |
| - <div id="sidebar"></div> |
38 |
| - <script src='/dist/mapbox-gl-dev.js'></script> |
39 |
| - <script src='/debug/access_token_generated.js'></script> |
40 |
| - <script> |
41 |
| - var map = window.map = new mapboxgl.Map({ |
42 |
| - container: 'map', |
43 |
| - zoom: 5, |
44 |
| - center: [-77.01866, 38.888], |
45 |
| - bearing: 0, |
46 |
| - style: 'mapbox://styles/mapbox/streets-v10', |
47 |
| - hash: false |
48 |
| - }); |
| 15 | +<div id='map'></div> |
49 | 16 |
|
50 |
| - map.on('load', () => { |
51 |
| - const boundsSW = [-132.890625, |
52 |
| - 19.31114335506464], |
53 |
| - boundsNE = [-56.953125, |
54 |
| - 52.05249047600099], |
55 |
| - bounds = mapboxgl.LngLatBounds.convert([boundsSW, boundsNE]); // map.fitBounds(bounds); |
56 |
| - // [n,e,s,w] |
57 |
| - // sw: [w,s] = [x,y] |
58 |
| - // ne: [e,n] = [x,y] |
59 |
| - const padding = {north: 30, east: 0, south: 0, west: 200}; |
60 |
| - // var newNE = map.project(bounds.getNorthEast()).add(mapboxgl.Point.convert([padding.east, -padding.north])); |
61 |
| - // var newSW = map.project(bounds.getSouthWest()).add(mapboxgl.Point.convert([-padding.west, padding.south])); |
| 17 | +<script src='/dist/mapbox-gl-dev.js'></script> |
| 18 | +<script src='/debug/access_token_generated.js'></script> |
| 19 | +<script> |
62 | 20 |
|
63 |
| - // const newNEgeo = map.unproject(newNE); |
64 |
| - // const newSWgeo = map.unproject(newSW); |
65 |
| - map.addSource('original', { |
66 |
| - type: 'geojson', |
67 |
| - data: { |
68 |
| - type: 'FeatureCollection', |
69 |
| - features: [{ |
70 |
| - type: 'Feature', |
71 |
| - geometry: { |
72 |
| - type: 'Point', |
73 |
| - coordinates: boundsNE |
74 |
| - }, |
75 |
| - properties: {} |
76 |
| - }, { |
77 |
| - type: 'Feature', |
78 |
| - geometry: { |
79 |
| - type: 'Point', |
80 |
| - coordinates: boundsSW |
81 |
| - }, |
82 |
| - properties: {} |
83 |
| - }] |
84 |
| - } |
85 |
| - }); |
86 |
| - // map.addSource('new', { |
87 |
| - // type: 'geojson', |
88 |
| - // data: { |
89 |
| - // type: 'FeatureCollection', |
90 |
| - // features: [{ |
91 |
| - // type: 'Feature', |
92 |
| - // geometry: { |
93 |
| - // type: 'Point', |
94 |
| - // coordinates: [newNEgeo.lng, newNEgeo.lat] |
95 |
| - // }, |
96 |
| - // properties: {} |
97 |
| - // }, { |
98 |
| - // type: 'Feature', |
99 |
| - // geometry: { |
100 |
| - // type: 'Point', |
101 |
| - // coordinates: [newSWgeo.lng, newSWgeo.lat] |
102 |
| - // }, |
103 |
| - // properties: {} |
104 |
| - // }] |
105 |
| - // } |
106 |
| - // }); |
107 |
| - setTimeout(()=>{ |
108 |
| - map.fitBounds(bounds); |
109 |
| - }, 1000); |
110 |
| - map.addLayer({ |
111 |
| - id: 'original', |
112 |
| - source: 'original', |
113 |
| - type: 'circle', |
114 |
| - paint: { |
115 |
| - 'circle-radius': 5, |
116 |
| - 'circle-color': 'blue', |
117 |
| - 'circle-opacity': 0.7 |
118 |
| - } |
119 |
| - }) |
120 |
| - }); |
121 |
| - </script> |
122 |
| -</body> |
| 21 | +var map = window.map = new mapboxgl.Map({ |
| 22 | + container: 'map', |
| 23 | + zoom: 12.5, |
| 24 | + center: [-77.01866, 38.888], |
| 25 | + style: 'mapbox://styles/mapbox/streets-v10', |
| 26 | + hash: true |
| 27 | +}); |
123 | 28 |
|
| 29 | +</script> |
| 30 | +</body> |
124 | 31 | </html>
|
0 commit comments