-
Notifications
You must be signed in to change notification settings - Fork 13
/
gig-map.html
47 lines (39 loc) · 931 Bytes
/
gig-map.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
---
title: Every gig we've ever played
---
<div id='gig-map' class='gig-map'></div>
<script>
map = L.map('gig-map').setView(
[
51.50979,
-0.13204
],
10
);
L.tileLayer.provider('Stamen.Watercolor').addTo(map)
L.tileLayer.provider('Stamen.TonerLabels').addTo(map)
$.ajax({
headers: {
Accept: 'application/vnd.geo+json'
},
url: 'http://data.rawfunkmaharishi.uk/gigs',
dataType: 'json'
}).done(function(data) {
L.geoJson(data, {
onEachFeature: onEachFeature
}).addTo(map)
})
function onEachFeature(feature, layer) {
s = '<div class="gig-popup">'
s += feature.properties.name
s += '<hr />'
$.each(feature.properties.gigs, function(index, gig) {
s += '<a href="' + gig.url + '">'
s += moment(gig.date).format('Do MMMM YYYY')
s += '</a>'
s += '<br />'
})
s += '</div>'
layer.bindPopup(s)
}
</script>