There is a latlng distanceTo method: http://leafletjs.com/reference.html#latlng
distanceTo( <LatLng> otherLatlng ) Number Returns the distance (in
meters) to the given LatLng calculated using the Haversine formula.
See description on wikipedia
It calculates the distance (in meters) between two LatLng. However, sometimes I needs to know how many pixels are there between two points. Does anyone have ideas about this?
You can convert your coordinates to screen points using:
http://leafletjs.com/reference.html#map-latlngtolayerpoint
And then measure the distance between the two points with:
http://leafletjs.com/reference.html#point-distanceto
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With