generated from kauevestena/opensidewalkmap_beta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
map_experimental.html
168 lines (108 loc) · 6.99 KB
/
map_experimental.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script>
L_NO_TOUCH = false;
L_DISABLE_3D = false;
</script>
<style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style>
<style>#map {position:absolute;top:0;bottom:0;right:0;left:0;}</style>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.js"></script>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.css"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"/>
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css"/>
<meta name="viewport" content="width=device-width,
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style>
#map_9ece2d20fe5573b13792cb0c3affc4b2 {
position: relative;
width: 100.0%;
height: 100.0%;
left: 0.0%;
top: 0.0%;
}
.leaflet-container { font-size: 1rem; }
</style>
<script src="https://unpkg.com/leaflet.vectorgrid@latest/dist/Leaflet.VectorGrid.bundled.js"></script>
<script type="text/javascript" src="assets/mapdata/sidewalks.js"></script>
<script type="text/javascript" src="assets/mapdata/kerbs.js"></script>
<script type="text/javascript" src="assets/mapdata/crossings.js"></script>
</head>
<body>
<div class="folium-map" id="map_9ece2d20fe5573b13792cb0c3affc4b2" ></div>
</body>
<script>
var map_9ece2d20fe5573b13792cb0c3affc4b2 = L.map(
"map_9ece2d20fe5573b13792cb0c3affc4b2",
{
center: [-25.460886197071005, -49.26133629920258],
crs: L.CRS.EPSG3857,
maxBounds: [[-25.6450101, -49.38914], [-25.3467009, -49.1843182]],
zoom: 18,
zoomControl: false,
preferCanvas: false,
}
);
var tile_layer_8ef5ee895e90c6c46db0b7bd4ec9e99e = L.tileLayer(
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
{"attribution": "Data by \u0026copy; \u003ca target=\"_blank\" href=\"http://openstreetmap.org\"\u003eOpenStreetMap\u003c/a\u003e, under \u003ca target=\"_blank\" href=\"http://www.openstreetmap.org/copyright\"\u003eODbL\u003c/a\u003e.", "detectRetina": false, "maxNativeZoom": 19, "maxZoom": 22, "minZoom": 10, "noWrap": false, "opacity": 0.3, "subdomains": "abc", "tms": false}
).addTo(map_9ece2d20fe5573b13792cb0c3affc4b2);
</script>
<script>
var vectorGrid_sidewalks = L.vectorGrid.slicer(
sidewalks_layer,
{
rendererFactory: L.svg.tile,
// rendererFactory: L.canvas.tile,
vectorTileLayerStyles: {
sliced:
function (properties, zoom) {
var p = properties.surface;
return {
color: p === "asphalt" ? "#fb8072" : p === "concrete" ? "#80b1d3" : p === "concrete:plates" ? "#fccde5" : p === "paving_stones" ? "#bebada" : p === "sett" ? "#ffed6f" : p === "cobblestone" ? "#ffed6f" : p === "unhewn_cobblestone" ? "#ffffb3" : p === "ground" ? "#fdb462" : p === "dirt" ? "#fdb462" : p === "earth" ? "#fdb462" : p === "sand" ? "#fdb462" : p === "grass" ? "#b3de69" : p === "paved" ? "#ffffff" : p === "unpaved" ? "#d9d9d9" : p === "gravel" ? "#bc80bd" : p === "compacted" ? "#bc80bd" : p === "ceramic:tiles" ? "#bc80bd" : p === "wood" ? "#bc80bd" : p === "metal" ? "#bc80bd" :"#434343",
weight: 8,
}
},
},
maxZoom: 22,
tolerance: 15,
indexMaxZoom: 18,
debug: 0,
extent: 4096,
interactive: true,
promoteId:"id",
getFeatureId: function (f) {
return f.properties.id;
}
}
)
.on('mouseover', function (e) {
var properties = e.layer.properties;
var popup = L.popup()
popup.setContent(properties.surface).setLatLng(e.latlng).openOn(map_9ece2d20fe5573b13792cb0c3affc4b2);
p = properties.surface;
var style = {
color: p === "asphalt" ? "#fb8072" : p === "concrete" ? "#80b1d3" : p === "concrete:plates" ? "#fccde5" : p === "paving_stones" ? "#bebada" : p === "sett" ? "#ffed6f" : p === "cobblestone" ? "#ffed6f" : p === "unhewn_cobblestone" ? "#ffffb3" : p === "ground" ? "#fdb462" : p === "dirt" ? "#fdb462" : p === "earth" ? "#fdb462" : p === "sand" ? "#fdb462" : p === "grass" ? "#b3de69" : p === "paved" ? "#ffffff" : p === "unpaved" ? "#d9d9d9" : p === "gravel" ? "#bc80bd" : p === "compacted" ? "#bc80bd" : p === "ceramic:tiles" ? "#bc80bd" : p === "wood" ? "#bc80bd" : p === "metal" ? "#bc80bd" :"#434343",
weight: 20
};
lastHoveredFeatureId = properties.id;
vectorGrid_sidewalks.setFeatureStyle(lastHoveredFeatureId, style);
}
)
.addTo(map_9ece2d20fe5573b13792cb0c3affc4b2);
vectorGrid_sidewalks.on('mouseout', function (e) {
if (lastHoveredFeatureId) {
vectorGrid_sidewalks.resetFeatureStyle(lastHoveredFeatureId);
//map_9ece2d20fe5573b13792cb0c3affc4b2.closePopup();
// L.closePopup();
}
})
</script>
</html>