forked from nycmeshnet/node-db
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Mapbox.html
51 lines (47 loc) · 1.43 KB
/
Mapbox.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Display a globe on a webpage</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<link href="https://api.mapbox.com/mapbox-gl-js/v2.10.0/mapbox-gl.css" rel="stylesheet">
<script src="https://api.mapbox.com/mapbox-gl-js/v2.10.0/mapbox-gl.js"></script>
<style>
body { margin: 0; padding: 0; }
#map { position: absolute; top: 0; bottom: 0; width: 100%; }
</style>
</head>
<body>
<div id="map"></div>
<script>
mapboxgl.accessToken = 'pk.eyJ1IjoibWlhd2ludGFtIiwiYSI6ImNrd21kd2F1MjBmNmQyd253bzJxeWVqZHMifQ.7KFJF5Jq8YyFs1RUSsLcbw';
const map = new mapboxgl.Map({
container: 'map',
// Choose from Mapbox's core styles, or make your own style with Mapbox Studio
style: 'mapbox://styles/miawintam/cl9x4r3rb000m14n1qoen174v',
zoom: 10,
center: [-74, 40.75],
projection: 'globe',
});
map.on("load", () => {
map.addSource("Nodes", {
type: 'vector',
url: 'mapbox://miawintam.cla2xzaxa0ja720mcer08gls0-1jp48'
});
map.addLayer({
id: "Nodes-data",
type: "points",
source: "Nodes",
layout: {
"icon-image": "custom-marker",
// get the title name from the source's "title" property
"text-field": ["get", "notes"],
"text-font": ["Open Sans Semibold", "Arial Unicode MS Bold"],
"text-offset": [0, 1.25],
"text-anchor": "top"
}
});
});
</script>
</body>
</html>