-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmapbox-3.html
More file actions
33 lines (30 loc) · 947 Bytes
/
mapbox-3.html
File metadata and controls
33 lines (30 loc) · 947 Bytes
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Mapbox 3</title>
<script src="js/mapbox-geocode-utils.js"></script>
<script src='https://api.mapbox.com/mapbox-gl-js/v1.10.0/mapbox-gl.js'></script>
<link href='https://api.mapbox.com/mapbox-gl-js/v1.10.0/mapbox-gl.css' rel='stylesheet' />
</head>
<body>
<script src="js/keys.js"></script>
<div id='map' style='width: 100vw; height: 300px;'></div>
<script>
mapboxgl.accessToken = MAPBOX_KEY;
var map = new mapboxgl.Map({
container: 'map',
zoom: 10,
center: [-98.4916, 29.42532],
style: 'mapbox://styles/mapbox/streets-v9'
});
geocode("Whitefish, Montana", MAPBOX_KEY).then(function(result) {
console.log(result);
map.setCenter(result);
})
reverseGeocode({lat: 21.2620, lng:-157.8060}, MAPBOX_KEY).then(function(result) {
console.log(result);
})
</script>
</body>
</html>