-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmapbox-1.html
62 lines (50 loc) · 1.52 KB
/
mapbox-1.html
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
<head>
<meta charset="UTF-8">
<title>Mapbox - 1</title>
<!-- Mapbox CSS -->
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.53.0/mapbox-gl.css' rel='stylesheet'/>
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v1.2.1/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v1.2.1/mapbox-gl.css' rel='stylesheet'/>
<!-- Custom CSS -->
<style>
#map {
/* the width and height may be set to any size */
width: 100%;
height: 700px;
}
</style>
<script src="js/keys.js" type="text/javascript"></script>
</head>
<body>
<div id='map' style='width: 100%; height: 600px;'></div>
<!-- Custom JS -->
<script>
/** Hometown */
mapboxgl.accessToken = mapboxToken;
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/streets-v9',
zoom: 10,
center: [-100.3161, 25.6866]
});
// var marker = new mapboxgl.Marker()
// .setLngLat([[-100.3161, 25.6866])
// .addTo(map);
/** New location */
function changeLocation() {
var newLocation = {
center: [-95.7129, 37.0902] //center: [-100.3161, 25.6866]
}
map.jumpTo(newLocation);
// marker.remove();
};
/** Set time out */
// setTimeout(changeLocation, 5000);
setTimeout( function(){
map.setStyle('mapbox://styles/mapbox/satellite-v9');
map.setZoom(3);
changeLocation();
}, 5000);
</script>
</body>
</html>