-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirst-map.html
More file actions
50 lines (44 loc) · 1.45 KB
/
first-map.html
File metadata and controls
50 lines (44 loc) · 1.45 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>First Map</title>
<link href='https://api.mapbox.com/mapbox-gl-js/v2.7.0/mapbox-gl.css' rel='stylesheet' />
<style>
#map {
height: 500px;
width: 800px;
}
</style>
</head>
<body>
<div id='map'></div>
<script src='https://api.mapbox.com/mapbox-gl-js/v2.7.0/mapbox-gl.js'></script>
<script src="js/mapbox-geocoder-utils.js"></script>
<script src="js/keys.js"></script>
<script>
"use strict";
mapboxgl.accessToken = MAPBOX_API_TOKEN;
var map = new mapboxgl.Map({
container: 'map', // container ID
style: 'mapbox://styles/mapbox/streets-v11', // style URL
center: [-116.2023, 43.6150], // starting position [lng, lat]
zoom: 9 // starting zoom
});
// Mini - Exercise 1 (before markers)
//
// In this file, create a Mapbox map that shows your home town. After 5 seconds, have the map automatically change to a map of the entire United States using a satellite style.
setTimeout(function (){
map.setCenter[-95.7129, 37.0902],
map.setZoom(2)
map.setStyle('mapbox://styles/mapbox/satellite-v9')
}, 5000)
geocode("Meridian, ID", MAPBOX_API_TOKEN).then(function(data){
console.log(data);
})
reverseGeocode({lng: -116.3923, lat: 43.6086}, MAPBOX_API_TOKEN).then(function(data){
console.log(data);
})
</script>
</body>
</html>