Click on the map to find the closest marker.
Get closest HTML marker to position
This sample shows how to calculate the closest marker to a given position, in this case, where the user clicked on the map. The closest marker will have it's color changed to red. This is achieved by looping over through the data and calculating the distance between the position and each marker using the atlas.math.getDistanceTo function.