layout | title | permalink |
---|---|---|
page |
Issues |
/issues/ |
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.min.js"></script> <style> #map{ height: 400px } </style> <script src="{{ site.url }}/js/Control.Geocoder.js"></script>
Latitudine
Longitudine
{% for member in site.data.issuesjson %}
{% if member.issue.labels contains "Notizie Utili" %}
{% endif %}
{% endfor %}
{% for member in site.data.issuesjson %}
{% if member.issue.labels contains "Alloggi" %}
{% endif %}
{% endfor %}
{% for member in site.data.issuesjson %}
{% if member.issue.labels contains "Donazioni" %}
{% endif %}
{% endfor %}
{% for member in site.data.issuesjson %}
{% if member.issue.labels contains "Fabbisogni" %}
{% endif %}
{% endfor %}
{% for member in site.data.issuesjson %}
{% if member.issue.labels contains "Raccolte Fondi" %}
{% endif %}
{% endfor %}
{% for member in site.data.issuesjson %}
{% if member.issue.labels contains "Bollettino" %}
{% endif %}
{% endfor %}
<script>
var markerList=[];
{% for member in site.data.issuesjson %}
{% if member.issue.lat != blank and member.issue.lon != blank %}
{% if member.issue.labels contains "Notizie Utili" %}
markerList.push([{{member.issue.lat}}, {{member.issue.lon}}, "{{member.title|uri_escape}}", "{{ member.number }}", "Notizie Utili"]);
{% elsif member.issue.labels contains "Alloggi" %}
markerList.push([{{member.issue.lat}}, {{member.issue.lon}}, "{{member.title|uri_escape}}", "{{ member.number }}", "Alloggi"]);
{% elsif member.issue.labels contains "Fabbisogni" %}
markerList.push([{{member.issue.lat}}, {{member.issue.lon}}, "{{member.title|uri_escape}}", "{{ member.number }}", "Fabbisogni"]);
{% elsif member.issue.labels contains "Donazioni" %}
markerList.push([{{member.issue.lat}}, {{member.issue.lon}}, "{{member.title|uri_escape}}", "{{ member.number }}", "Donazioni"]);
{% elsif member.issue.labels contains "Raccolte Fondi" %}
markerList.push([{{member.issue.lat}}, {{member.issue.lon}}, "{{member.title|uri_escape}}", "{{ member.number }}", "Raccolte Fondi"]);
{% else %}
markerList.push([{{member.issue.lat}}, {{member.issue.lon}}, "{{member.title|uri_escape}}", "{{ member.number }}", ""]);
{% endif %}
{% endif %}
{% endfor %}
var alloggiMarker = L.AwesomeMarkers.icon({
icon: 'home',
prefix: 'fa',
markerColor: 'green'
});
var fabbisogniMarker = L.AwesomeMarkers.icon({
icon: 'child',
prefix: 'fa',
markerColor: 'blue'
});
var notizieutiliMarker = L.AwesomeMarkers.icon({
icon: 'newspaper-o',
prefix: 'fa',
markerColor: 'orange'
});
var donazioniMarker = L.AwesomeMarkers.icon({
icon: 'handshake-o',
prefix: 'fa',
markerColor: 'red'
});
var raccoltefondiMarker = L.AwesomeMarkers.icon({
icon: 'money',
prefix: 'fa',
markerColor: 'blue'
});
// initialize the map
var map = L.map('map')
// create the tile layer with correct attribution
var osmUrl='http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png';
var osmAttrib='© OpenStreetMap, Tiles courtesy of Humanitarian OpenStreetMap Team';
var osm = new L.TileLayer(osmUrl, {minZoom: 6, maxZoom: 19, attribution: osmAttrib});
var sumLat = 0.;
var sumLon = 0.;
for (var i=0; i" + decodeURI(popupText) + "");
sumLat += lat;
sumLon += lon;
}
}
map.addLayer(osm).setView([42.629381, 13.288372], 6);
var geocoder = L.Control.geocoder({collapsed:false,placeholder:"Cerca...",
defaultMarkGeocode: false, geocodingQueryParams: { countrycodes: "it" },
})
.on('markgeocode', function(e) {
var latlon=e.geocode.center;
$("#lat").html(latlon.lat);
$("#lng").html(latlon.lng);
var marker = new L.Marker(markerLocation);
map.addLayer(marker);
})
.addTo(map);
</script>