-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjungfrau.html
139 lines (119 loc) · 4.91 KB
/
jungfrau.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.37.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.37.0/mapbox-gl.css' rel='stylesheet' />
<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.eyJ1IjoianVuZ2ZyYXUiLCJhIjoiY2lxOWVuaHBtMDA1MWhya3EydWhmdWNrNyJ9.tSTlibOho2Mo3qXdUYZVEQ';
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/jungfrau/cj2zyeeth000j2sqyq01h7bbc',
center: [7.983, 46.670],
zoom: 12
});
map.on('style.load', function () {
// map.addSource("states", {
// "type": "geojson",
// "data": "https://raw.githubusercontent.com/lena-emaya/construct/master/gps.geojson"
// });
//
//
// map.addLayer({
// "id": "route-hover",
// "type": "line",
// "source": "states",
// "layout": {},
// "paint": {
// "line-color": "#FFC445",
// "line-width": 2.5,
// "line-gap-width": 1,
// },
// "filter": ["==", "name", ""]
// });
// map.on('mousemove', function(e) {
// map.featuresAt(e.point, {
// radius: 5,
// layer: ["m_streets"]
// }, function (err, features) {
// if (!err && features.length) {
// map.setFilter('route-hover', ['==', 'name', features[0].properties.name]);
// } else {
// map.setFilter('route-hover', ['==', 'name', '']);
// }
// });
// });
// map.on("mousemove", function(e) {
// var features = map.queryRenderedFeatures(e.point, { layers: ["new_h3_line"] });
// if (features.length) {
// map.setFilter("new_h3_hover", ["==", "name", features[0].properties.name]);
// } else {
// map.setFilter("new_h3_hover", ["==", "name", ""]);
// }
// });
//
// // Reset the state-fills-hover layer's filter when the mouse leaves the map
// map.on("mouseout", function() {
// map.setFilter("new_h3_hover", ["==", "name", ""]);
// });
map.on("mousemove", function(k) {
var features = map.queryRenderedFeatures(k.point, { layers: ["hover_2"] });
if (features.length) {
map.setFilter("hover_copy", ["==", "name", features[0].properties.name]);
} else {
map.setFilter("hover_copy", ["==", "name", ""]);
}
});
// Reset the state-fills-hover layer's filter when the mouse leaves the map
map.on("mouseout", function() {
map.setFilter("hover_copy", ["==", "name", ""]);
});
map.on("mousemove", function(m) {
var features = map.queryRenderedFeatures(m.point, { layers: ["hover_2"] });
if (features.length) {
map.setFilter("hover_copy_1", ["==", "name", features[0].properties.name]);
} else {
map.setFilter("hover_copy_1", ["==", "name", ""]);
}
});
// Reset the state-fills-hover layer's filter when the mouse leaves the map
map.on("mouseout", function() {
map.setFilter("hover_copy_1", ["==", "name", ""]);
});
map.on("mousemove", function(d) {
var features = map.queryRenderedFeatures(d.point, { layers: ["point-a copy"] });
if (features.length) {
map.setFilter("point-a", ["==", "name", features[0].properties.name]);
} else {
map.setFilter("point-a", ["==", "name", ""]);
}
});
// Reset the state-fills-hover layer's filter when the mouse leaves the map
map.on("mouseout", function() {
map.setFilter("point-a", ["==", "name", ""]);
});
map.on("mousemove", function(d) {
var features = map.queryRenderedFeatures(d.point, { layers: ["point-b-copy"] });
if (features.length) {
map.setFilter("point-b", ["==", "name", features[0].properties.name]);
} else {
map.setFilter("point-b", ["==", "name", ""]);
}
});
// Reset the state-fills-hover layer's filter when the mouse leaves the map
map.on("mouseout", function() {
map.setFilter("point-b", ["==", "name", ""]);
});
});
</script>
</body>
</html>