forked from Jalberque/TODD_leaflet_demo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmap3.html
63 lines (57 loc) · 1.71 KB
/
map3.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
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Leaflet Demo</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css" />
<style>
#map {
height: 100%;
width: 100%;
}
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="map"></div>
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js"></script>
<script type="text/javascript">
var map = L.map('map').setView([35.7769, -78.6436],10);
//L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
L.tileLayer('http://{s}.tile.stamen.com/toner/{z}/{x}/{y}.png').addTo(map);
$.getJSON('poi_wgs.geojson', function(json) {
L.geoJson(json).addTo(map);
});
$.getJSON('city_limits.geojson', function(json) {
L.geoJson(json, {style: style}).addTo(map);
});
function getColor(d) {
return d > 16000000 ? '#800026' :
d > 10000000 ? '#BD0026' :
d > 5000000 ? '#E31A1C' :
d > 2000000 ? '#FC4E2A' :
d > 500000 ? '#FD8D3C' :
d > 2000 ? '#FEB24C' :
d > 10 ? '#FED976' :
'#FFEDA0';
}
function style(feature) {
return {
fillColor: getColor(feature.properties.SHAPE_AREA),
weight: .2,
opacity: 1,
color: 'white',
dashArray: '.3',
fillOpacity: 0.5
};
}
</script>
</html>