forked from mapbox/mapbox-gl-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultiple.html
More file actions
86 lines (79 loc) · 1.99 KB
/
Copy pathmultiple.html
File metadata and controls
86 lines (79 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!DOCTYPE html>
<html>
<head>
<title>Mapbox GL JS debug page</title>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<link rel='stylesheet' href='../dist/mapbox-gl.css' />
<style>
body { margin: 0; padding: 0; }
.map { width: 300px; height: 300px; display: block; float: left; margin: 5px; }
</style>
</head>
<body>
<div class='map'></div>
<div class='map'></div>
<div class='map'></div>
<div class='map'></div>
<script src='../dist/mapbox-gl-dev.js'></script>
<script src='../debug/access_token_generated.js'></script>
<script>
var style = {
"version": 8,
"sources": {
"satellite": {
"type": "raster",
"url": "mapbox://mapbox.satellite",
"tileSize": 256
},
"streets": {
"type": "vector",
"url": "mapbox://mapbox.mapbox-streets-v7"
}
},
"layers": [{
"id": "background",
"type": "background",
"paint": {
"background-color": "rgb(4,7,14)"
}
}, {
"id": "satellite",
"type": "raster",
"source": "satellite"
}, {
"id": "road",
"type": "line",
"source": "streets",
"source-layer": "road",
"paint": {"line-color": "rgb(55,89,144)", "line-width": 4}
}]
};
function addMap (container) {
var map = new mapboxgl.Map({
container,
minZoom: 14,
zoom: 15.5,
center: [-122.514426, 37.562984],
bearing: -96,
style,
hash: false
});
map.addControl(new mapboxgl.GeolocateControl({
positionOptions: {
enableHighAccuracy: true
},
trackUserLocation: true,
showUserLocation: true,
fitBoundsOptions: {
maxZoom: 20
}
}));
}
var containers = document.querySelectorAll('.map');
for (var i = 0; i < containers.length; i++) {
addMap(containers[i]);
}
</script>
</body>
</html>