David David - 15 days ago 6
Javascript Question

Leaflet get sub-polyline with specific start and end point

I want to get a "sub-Polyline" of a given polyline that is determined by a certain start and end point (in meters).

For example I have a polyline that is 500 meters (build using 30 coordinates (not seperated in same spaces)) and I want to color the line between meter 200 and 300 in a different color. Is it possible using Leaflet functions?

Answer

Take a look at the LineStringSelect plugin here: https://github.com/w8r/L.Control.LineStringSelect

With the demo (click in 2 different locations on the polyline):

https://w8r.github.io/L.Control.LineStringSelect

Comments