-
Notifications
You must be signed in to change notification settings - Fork 0
/
presentation.html
50 lines (49 loc) · 1.48 KB
/
presentation.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
<!DOCTYPE html>
<html>
<head>
<title>GeoJSON Presentation</title>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<link href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.1/leaflet.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.1/leaflet.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-ajax/2.1.0/leaflet.ajax.js"></script>
<style>
html, body, #map {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
}
</style>
</head>
<body>
<div id='map'>
</div>
<script>
var map = L.map('map').setView([1.128257, 104.0283], 12)
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap<\/a> contributors'
}).addTo(map);
var output = new L.GeoJSON.AJAX("output.geojson", {
onEachFeature: function(feature, layer) {
if (feature.properties) {
var props = ''
for (name in feature.properties) {
props += '<tr><td>' + name + '</td><td>' + feature.properties[name] + '</td></tr>';
}
layer.bindPopup('<table>' + props + '</table>');
}
},
style: function(feature) {
if (feature.properties && feature.properties.place !== 'island') {
return {
color: '#ff0000'
}
}
}
});
console.log(output)
output.addTo(map);
</script>
</body>
</html>