-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.html
69 lines (51 loc) · 1.84 KB
/
example.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
<!DOCTYPE html>
<html>
<head>
<title>Responders</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="dist/leaflet.css" />
<!--[if lte IE 8]><link rel="stylesheet" href="dist/leaflet.ie.css" /><![endif]-->
</head>
<body>
<div id="map" style="width: 100%; height: 500px"></div>
<script src="dist/leaflet.js"></script>
<script src="js/jquery-1.10.2.min.js"></script>
<script>
function onEachFeature(feature, layer) {
var popupContent = "";
if (feature.properties && feature.properties.popupContent) {
popupContent += feature.properties.popupContent;
}
layer.bindPopup(popupContent);
}
var map = L.map('map').setView([7, 124], 8);
L.tileLayer('http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png', {
maxZoom: 13,
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://cloudmade.com">CloudMade</a>'
}).addTo(map);
// Pulls GeoJSON data and adds layer to the basemap
jQuery.getJSON('881953.json', function(geojsonFeature){
var myLayer = L.geoJson(geojsonFeature, {
style: function (feature) {
return feature.properties && feature.properties.style;
},
onEachFeature: onEachFeature,
pointToLayer: function (feature, latlng) {
return L.circleMarker(latlng, {
radius: 5,
fillColor: "#ff7800",
color: "#000",
weight: 1,
opacity: 1,
fillOpacity: 0.8
});
}
}).addTo(map);
myLayer.addData(geojsonFeature);
// Zooms map to geoJSON layer's bounds
map.fitBounds(myLayer.getBounds());
});
</script>
</body>
</html>