-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmapbox-api-lec.html
More file actions
36 lines (29 loc) · 997 Bytes
/
mapbox-api-lec.html
File metadata and controls
36 lines (29 loc) · 997 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
34
35
36
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Mapbox API</title>
<!--MapboxTags-->
<link href='https://api.mapbox.com/mapbox-gl-js/v2.2.0/mapbox-gl.css' rel='stylesheet' />
</head>
<body>
<h1>Welcome to mapbox</h1>
<div id='map' style='width: 80vw; height: 80vh; margin: auto;'></div>
<button type="button" id="sat-map">Change map Style</button>
<script src="js/jquery-3.6.0.min.js"></script>
<script src="js/keys.js"></script>
<script src='https://api.mapbox.com/mapbox-gl-js/v2.2.0/mapbox-gl.js'></script>
<script>
mapboxgl.accessToken = MAPBOX_ACCESS_TOKEN;
var map = new mapboxgl.Map({
container: 'map', // container ID
style: 'mapbox://styles/mapbox/streets-v11', // style URL
center: [-98.4916, 29.4252], // starting position [lng, lat]
zoom: 9 // starting zoom
});
$("#sat-map").click(function(){
map.setStyle("mapbox://styles/mapbox/dark-v10");
});
</script>
</body>
</html>