-
Notifications
You must be signed in to change notification settings - Fork 0
/
nRsn.VectorTileLayer.kharkov.buildings.html
104 lines (83 loc) · 2.91 KB
/
nRsn.VectorTileLayer.kharkov.buildings.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0" />
<title>1</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5/leaflet.ie.css" />
<![endif]-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<script src="assets/nRsn.leaflet/nRsn.VectorTileLayer.js"></script>
<style type="text/css">
html,
body {
height: 100%
}
#map {
min-height: 100%;
}
body {
margin: 0;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 12px;
overflow: hidden;
background-color: #f00;
}
</style>
</head>
<body>
<div id="map"></div>
<script type="text/javascript">
var map = L.map('map').setView([50.0068, 36.2319], 17);
var openStreetMap = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
});
openStreetMap.addTo(map);
var style = {
"clickable": true,
"color": "#00D",
"fillColor": "#00D",
"weight": 1.0,
"opacity": 0.3,
"fillOpacity": 0.2
};
var hoverStyle = {
"fillOpacity": 0.5
};
var geojsonURL = "data/mmt.vector.tiles.kharkov.buildings/{z}/{x}/{y}.geojson";
var dynamicLayer = new L.VectorTileLayer(geojsonURL, {
clipTiles: true,
unique: function(feature) {
return feature.properties.gid;
console.log(feature.properties.gid);
},
minZoom: 15
}, {
style: style,
onEachFeature: function(feature, layer) {
if (feature.properties) {
var popupString = '<div class="popup">';
for (var k in feature.properties) {
var v = feature.properties[k];
popupString += k + ': ' + v + '<br />';
}
popupString += '</div>';
layer.bindPopup(popupString);
}
if (!(layer instanceof L.Point)) {
layer.on('mouseover', function() {
layer.setStyle(hoverStyle);
});
layer.on('mouseout', function() {
layer.setStyle(style);
});
}
}
});
map.addLayer(dynamicLayer);
</script>
</body>
</html>