{% load typogrify_tags %} {% load truncateletters %} var map = L.map('map-inner-canvas') // center on a country function focusCountry(latitude, longitude, zoom) { map.panTo(new L.LatLng(latitude, longitude)); map.setZoom(zoom); }; {% for route in route_list %} var {{route.template_var_name}} = L.polygon([ {% for point in route.geometry.coords%} [{{point.1}}, {{point.0}}]{% if forloop.last%}{%else%},{%endif%} {% endfor %} ]); {% endfor %} function showRoute(route, zoom, latitude, longitude) { map.panTo(new L.LatLng(latitude, longitude)); map.setZoom(zoom); eval(route).addTo(map); return false; }; //check for a permalink //find a centerpoint var pts = new Array(); {%for c in country_list%}pts[{{forloop.counter0}}] = ["#{{c.slug}}", {{c.lat}},{{c.lon}},{{c.zoom_level}}]; {% endfor %} {%for c in region_list%}pts[pts.length] = ["#{{c.slug}}", {{c.lat}},{{c.lon}},{{c.zoom_level}}]; {% endfor %} if (window.location.hash) { for (var i=0; i < pts.length; i++) { if (window.location.hash == pts[i][0]) { var centerCoord = new L.LatLng(pts[i][1],pts[i][2]); var zoom = pts[i][3]; break; } else { var centerCoord = new L.LatLng(19.311143,2.460938); var zoom = 2; } } } else { centerCoord = new L.LatLng(19.311143,2.460938); zoom = 2; } //Set center map.setView(centerCoord, zoom); L.tileLayer.provider('Esri.WorldTopoMap', {maxZoom: 18,attribution: 'Map data © OpenStreetMap contributors, CC-BY-SA, Tiles © Esri and the GIS User Community'}).addTo(map); //loop through and set up markers/info windows {% for entry in object_list %} L.marker([{{entry.latitude}}, {{entry.longitude}}]).bindPopup('

{{entry.title}}<\/h4>{{entry.pub_date|date:"F j, Y"}} ({% if entry.location.state.country.name == "United States" %}{{entry.location.name|smartypants|safe}}, {{entry.location.state.name}}){%else%}{{entry.location.name|smartypants|safe}}, {{entry.location.state.country.name}}){%endif%}<\/span>

{{ entry.title }}{{entry.dek|escapejs}} Read it »<\/a><\/p><\/div>').addTo(map); {% endfor %}