-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
51 lines (51 loc) · 1.95 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
49
50
51
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>The fault in our parks: Leaflet map crash course</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<script type="text/javascript" src="http://maps.stamen.com/js/tile.stamen.js?v1.3.0"></script>
<style type="text/css">
.map {
height: 700px;
}
</style>
</head>
<body>
<div id="map" class="map"></div>
<script src="data/parks.js"></script>
<script src="data/faults.js"></script>
<script type="text/javascript">
var map = L.map('map').setView([44.05, -121.30], 11);
var layer = new L.StamenTileLayer("toner-lite");
map.addLayer(layer);
/* var imagery = L.tileLayer.wms("http://navigator.state.or.us/ArcGIS/services/Framework/Imagery_Mosaic2011/ImageServer/WMSServer", {
layers: 'Imagery_Mosaic2011',
format: 'image/jpeg',
attribution: "Imagery © 2014 Oregon"
});
map.addLayer(imagery); */ // We can also add WMS layers as tile layers very easily. This is 2011 satellite imagery hosted by Oregon's GIS office.
L.geoJson(parks, {
style: {
"fillColor": "green",
"weight": 0,
"fillOpacity": 0.5
},
onEachFeature: function (feature, layer) {
layer.bindPopup('<strong>' + feature.properties.Park_Name + '</strong><br>Playground? ' + feature.properties.Playground); // You can use '+' to concatenate properties from the GeoJSON data with basic html elements to create unique popups
}
}).addTo(map);
L.geoJson(faults, {
style: {
"color": "red",
"weight": 1.5,
"opacity": .8
},
onEachFeature: function (feature, layer) {
layer.bindPopup('<strong>' + feature.properties.NAME + '</strong><br>Age: ' + feature.properties.AGE + ' years'); // Another popup example
}
}).addTo(map);
</script>
</body>
</html>