2

In a map in a web application, I would like to illustrate distance along a path, like how it is done with the measure distance tool in Google Maps (see attached image).

Is there a way to do this in Leaflet? Maybe with a plugin?

Screenshot from Google Maps showing a polyline path with distance tick marks at regular intervals.

1
  • There is currently no such functionality in Leaflet or Leaflet plugins.
    – TomazicM
    Jun 17, 2022 at 18:36

2 Answers 2

2

I just refreshed and published the leaflet-measure-distance plugin for leaflet.

There's a demo here: https://onaci.github.io/leaflet.measure/

It does pretty much exactly what you are described, except it doesn't have ticks... PR's welcome!

enter image description here

1
  • Thank you. However, ticks are very important for my use case. Oct 14, 2022 at 11:21
1

I eventually found the plugin leaflet-distance-markers (listed in the Leaflet Plugins database) which was sufficient for my use case.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.