-
Notifications
You must be signed in to change notification settings - Fork 1
/
gig-map.html
54 lines (46 loc) · 952 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
48
49
50
51
52
53
54
---
title: Every gig we’ve ever played
---
<div
class='gig-map rounded'
id='gig-map'
></div>
<script>
map = L.map('gig-map').setView(
[
51.50979,
-0.13204
],
11
);
{% include fragments/map-layers.js %}
$.getJSON('/gig-map.json', function(data) {
L.geoJson(data, {
onEachFeature: onEachFeature
})
})
function onEachFeature(feature, layer) {
s = `
<div
class='gig-map-popup'
>
<span class='venue-name'>
${ feature.properties.name }
</span>
`
$.each(feature.properties.gigs, function(index, gig) {
s += `
<a href="${ gig.url }">
${ moment(gig.date).format('Do MMMM YYYY') }
</a>
<br />
`
})
s += `</div>`
L.geoJSON(feature, {
pointToLayer: function(feature, latlng) {
return L.marker(latlng, {icon: marker})
}
}).bindPopup(s).addTo(map)
}
</script>