chiro-canto/public/explore/map/scripts/map.js

14 lines
598 B
JavaScript
Raw Normal View History

2021-04-16 13:41:22 +02:00
var map = L.map('map').setView([0, 0], 13).setZoom(1);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
for (let record of obs) {
L.circleMarker([record['lat'], record['lng']], {
radius: 2
}).addTo(map).on("click", function (e) {
e.target.bindPopup(`<em>${record['species']}</em> recorded on ${record['date']} <a href="/storage/records/${record['file_name']}"><i style="font-size:24px" class="fa">&#xf08e;</i></a>`);
});
}