forked from bdon/protomaps-workshop-sotmus24
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
85 lines (82 loc) · 2.52 KB
/
index.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE html>
<html lang="en">
<head>
<title>My Utah Map</title>
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel='stylesheet' href='https://unpkg.com/[email protected]/dist/maplibre-gl.css' />
<script src='https://unpkg.com/[email protected]/dist/maplibre-gl.js'></script>
<script src="https://unpkg.com/[email protected]/dist/pmtiles.js"></script>
<style>
body { margin: 0; padding: 0; }
html, body, #map { height: 100%; }
</style>
</head>
<body>
<div id="map"></div>
<script>
let protocol = new pmtiles.Protocol();
maplibregl.addProtocol("pmtiles",protocol.tile);
const style = {
version: 8,
glyphs: "https://protomaps.github.io/basemaps-assets/fonts/{fontstack}/{range}.pbf",
sources: {
trails: {
type: "vector",
url: "pmtiles://../utah_highway_path.pmtiles",
attribution: '© <a href="https://openstreetmap.org">OpenStreetMap contributors</a>'
},
terrain: {
type: "raster-dem",
url: "pmtiles://../utah_terrarium.pmtiles",
attribution: '© Joerd',
encoding: 'terrarium'
}
},
layers: [
{
id: "hillshade",
type: "hillshade",
source: "terrain",
paint: {
'hillshade-shadow-color':"#B3A47B"
}
},
{
id: "trails",
source: "trails",
'source-layer': 'utah_highway_path',
type: 'line',
paint: {
'line-color': 'black'
}
},
{
id: "trails_labels",
source: "trails",
'source-layer': 'utah_highway_path',
type: 'symbol',
layout: {
"symbol-placement": "point",
"text-font": ["Noto Sans Regular"],
"text-field": ["get", "name"],
"text-size": 10
},
paint: {
"text-halo-color": "white",
"text-halo-width": 2
},
minzoom: 10
}
]
};
const map = new maplibregl.Map({
container: 'map',
style: style,
center: [-112.181,39.377],
zoom: 6,
hash: true
});
</script>
</body>
</html>