forked from lyzidiamond/learn-geojson
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
48 lines (42 loc) · 1.41 KB
/
index.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
<!doctype html>
<html>
<head>
<title>MaptimePDX | GeoJSON!</title>
<meta charset="utf-8">
<link rel="stylesheet" href="https://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="https://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" />
<![endif]-->
<!-- THIS IS WHERE WE PUT ALL THE STYLE INFO FOR THE PAGE-->
<style type="text/css">
body {
padding: 0;
margin: 0;
}
html, body, #map {
height: 100%; /* make the map take up the whole page */
}
</style>
<body>
<!-- the 'map' div is where the map content is going -->
<div id="map"></div>
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="https://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<script>
// create a map in the "map" div, set the view to a given place and zoom
var map = L.map('map').setView([45.5, -122.7], 11);
// add an OpenStreetMap tile layer
L.tileLayer('https://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
// add our goejson data
$.getJSON("pdxplaces.geojson", function(data) {
var geojson = L.geoJson(data, {
onEachFeature: function (feature, layer) {
layer.bindPopup(feature.properties.Name); // add the Name property from the geojson to the popup
}
}).addTo(map);
});
</script>
</body>
</html>