-
Notifications
You must be signed in to change notification settings - Fork 0
/
index5.html
63 lines (54 loc) · 1.81 KB
/
index5.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
<!DOCTYPE html>
<html>
<head>
<title>Geog 483 Leaflet Tutorial</title>
<!-- This tutorial is based on the official Leaflet quickstart: http://leafletjs.com/examples/quick-start/ -->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
</head>
<body>
<style>
body { margin:0; padding:0; }
#mapid { position:absolute; top:50px; bottom:50px; left:50px; width:500px; height:500px;}
</style>
<div id="mapid"</div>
<script src="coffeeshop.geojson.txt" type="text/javascript"></script>
<script type='text/javascript'>
var mymap = L.map('mapid').setView([43.470, -80.546], 15);
L.tileLayer("http://tile.openstreetmap.org/{z}/{x}/{y}.png", {
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, '
}).addTo(mymap);
function onEachFeature(feature, layer) {
if (feature.properties) {
layer.bindPopup(
"<b>The price of coffee in " + feature.properties.name +"</b><br>\
<table style = 'width:300px'>\
<tr>\
<th> Category </th>\
<th> Price </th>\
</tr>\
<tr>\
<td>Coffee (S)</td>\
<td>"+feature.properties.coffee_pri+"</td>\
</tr>\
<tr>\
<td>Coffee (M)</td>\
<td>"+feature.properties.coffee_p_1+"</td>\
</tr>\
<tr>\
<td>Coffee (L)</td>\
<td>"+feature.properties.coffee_p_2+"</td>\
</tr>\
</table>\
*0 means data missing");
}
}
var coffeeshop = new L.geoJson(coffeShops, {
onEachFeature: onEachFeature
}).addTo(mymap);
</script>
</body>
</html>