How to find closest marker leaflet.js
I was wondering if there is actually some way to find markers near my position using leaflet.js. The first think to come to my head is to store lat and lng of my position and then iterate over an array of lat and lng markers placing them in an array an then sort that array. I am not sure if this is a good option because if you have a million markers in the map is going to take a while. Pseudo code var myLatLng = [34,56]; var markers = [[20,30],[10,20],[12,-100],[54,90],[-10, -20],[20,20]]; var closests = []; function findNearestMarker (myPosition, nearestMarkers){ for(var i = 0; i <