forked from codeforboston/MBTA-API-API
-
Notifications
You must be signed in to change notification settings - Fork 0
/
preview.html
49 lines (49 loc) · 1.51 KB
/
preview.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
<!doctype html>
<html lang="en">
<head>
<meta charset='utf-8'/>
<title>
Preview
</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" />
<![endif]-->
<style>
html { height: 100% }
body { height: 100%; margin: 0; padding: 0;}
#map{ height: 100% }
</style>
</head>
<body>
<div id="map"></div>
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<script>
function fileLoaded(geoJSON){
var map = L.map('map');
var geoJSONLayer = L.geoJson(geoJSON,{onEachFeature:function(feature,layer){
var key,popup;
if(feature.properties){
popup="<ul>";
for(key in feature.properties){
popup += "<li>"
popup += key;
popup += " : ";
popup += feature.properties[key];
popup += "</li>"
}
popup += "</ul>";
layer.bindPopup(popup);
}
}});
map.fitBounds(geoJSONLayer.getBounds());
L.tileLayer('http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpeg', {
attribution: 'Tiles Courtesy of <a href="http://www.mapquest.com/">MapQuest</a> — Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>',
subdomains: '1234'
}).addTo(map);
geoJSONLayer.addTo(map);
}
</script>
<script src="./?callback=fileLoaded"></script>
</body>
</html>