I am trying to show a specific earthquake event when the user clicks on details in the popup (right now it just shows all of them)
mymap.addLayer(markers);
let template = `
<h3>Earthquake</h3>
<article><a href="/data/earthquakes_events.json">Details</a></article>
`
markers.bindPopup(template);
I have written this function to return the specific earthquake:
let earthquakes = earthquakes_events.json
function GetEarthquake (lat, long) {
var index = earthquakes.findIndex(obj => obj.latitude == lat && obj.longitude == long)
return earthquakes[index] // returns the whole object
}
Now I would like to use this function with the latitude and longitude info from the mouseevent but I don't know how