-
Notifications
You must be signed in to change notification settings - Fork 0
/
map.html
44 lines (42 loc) · 1.03 KB
/
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
<head>
{% for link in links %}
{{link.render(embedded=embed_links)}}
{% endfor %}
<style>
{% block style %}
#map{{ mapid }} {
height:100%;
}
{% endblock %}
</style>
</head>
<body>
<div id="map{{ mapid }}"></div>
<script text="text/javascript">
{% block script_main %}
var map = L.map('map{{ mapid }}');
L.tileLayer(
"{{ tile_url }}",
{maxZoom:25, attribution: '{{ attribution }}'}).addTo(map);
var gjData = {{ geojson }};
if (gjData.features.length != 0) {
var gj = L.geoJson(gjData, {
style: function (feature) {
return feature.properties;
},
pointToLayer: function (feature, latlng) {
var icon = L.divIcon({'html': feature.properties.html,
iconAnchor: [feature.properties.anchor_x,
feature.properties.anchor_y],
className: 'empty'}); // What can I do about empty?
return L.marker(latlng, {icon: icon});
}
});
gj.addTo(map);
map.fitBounds(gj.getBounds());
} else {
map.setView([0, 0], 1);
}
{% endblock %}
</script>
</body>