You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.2 KiB
HTML
47 lines
1.2 KiB
HTML
|
|
|
|
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Simple Leaflet Map</title>
|
|
<meta charset="utf-8" />
|
|
<link
|
|
rel="stylesheet"
|
|
href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css"
|
|
/>
|
|
</head>
|
|
<body>
|
|
|
|
{%for country in countries%}
|
|
<a href ="{% url 'country' country.id%}">{{country}}</a>
|
|
{%endfor%}
|
|
|
|
<div id="map" style="width: 600px; height: 400px"></div>
|
|
|
|
<script
|
|
src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js">
|
|
</script>
|
|
|
|
<script>
|
|
|
|
var map = L.map('map').setView([-41.3058, 174.82082], 0);
|
|
mapLink =
|
|
'<a href="http://openstreetmap.org">OpenStreetMap</a>';
|
|
L.tileLayer(
|
|
'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
|
attribution: '© ' + mapLink + ' Contributors',
|
|
maxZoom: 18,
|
|
}).addTo(map);
|
|
|
|
{%for country in countries%}
|
|
|
|
marker = new L.marker([{%if country.latitude_direction == "S" %}-{%endif%}{{country.latitude_degrees}}, {%if country.longitude_direction == "W" %}-{%endif%}{{country.longitude_degrees}}])
|
|
.bindPopup("welcome to {{country.name}}, {{country.latitude_degrees}}, {{country.longitude_degrees}}")
|
|
.addTo(map);
|
|
{%endfor%}
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|