-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
79 lines (60 loc) · 2.29 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!DOCTYPE html>
<html>
<head>
<title>Tenderloin Matchbook Project</title>
<!-- reference to Leaflet CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.4.0/leaflet.css" />
<!-- reference to Leaflet JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.4.0/leaflet.js"></script>
<!-- Load Omnivore plugin to convert CSV to GeoJSON format -->
<script src='https://api.tiles.mapbox.com/mapbox.js/plugins/leaflet-omnivore/v0.3.1/leaflet-omnivore.min.js'></script>
<!-- set width and height styles for map -->
<style>
#map {
width: 100%;
height:960px;
}
/* add style to the popup here */
.custom .leaflet-popup-tip,
.custom .leaflet-popup-content-wrapper {
background: #ffffff;
color: #000000;
}
</style>
</head>
<body>
<!-- place holder for map -->
<div id="map"></div>
<script>
// create map object, tell it to live in 'map' div and give initial latitude, longitude, zoom values
var map = L.map('map', {scrollWheelZoom:false}).setView([37.78, -122.42], 14);
// add base map tiles from OpenStreetMap and attribution info to 'map' div
L.tileLayer('http://{s}.tile.stamen.com/toner-lite/{z}/{x}/{y}.png', {
attribution: 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, under <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a href="http://openstreetmap.org">OpenStreetMap</a>, under <a href="http://www.openstreetmap.org/copyright">ODbL</a>.'
}).addTo(map);
// specify popup options
var customOptions =
{
'maxWidth': '500',
'className' : 'custom'
}
var customLayer = L.geoJSON(null, {
onEachFeature: function (feature, layer) {
layer.bindPopup(
"<h2>" + feature.properties.Name + "</h2>"
+ feature.properties.Address
+ "<br>" + feature.properties.Motto
+ "<br><img src='./images/" + feature.properties.Image
+ "' width='450px'/>"
+ "<br>" + feature.properties.Description
,customOptions);
}
});
// See: https://github.com/JackDougherty/leaflet-map-csv
var runLayer = omnivore.csv("./locations.csv", null, customLayer)
.on('ready', function() {
map.fitBounds(runLayer.getBounds());
})
.addTo(map);
</script>
</body>