So I am interested in knowing how far along a polyline a given point sits. Python's shapely package has a method to do such a thing, see the below code:
from shapely.geometry import LineStringip = LineString([(0, 0), (0, 1), (1, 1)]).interpolate(1.5)print LineString([(0, 0), (0, 1), (1, 1)]).project(ip)> 1.5Now if I changed the polyline to fold back on itself it only returns 1 distance (the smallest distance), see the code below:
from shapely.geometry import LineStringip = LineString([(0, 0), (0, 1), (0, 0)]).interpolate(1.5)print LineString([(0, 0), (0, 1), (0, 0)]).project(ip)> 0.5In reality the answer to this question is 0.5 and 1.5.
My question is how do I get it to return all of the distances that may belong to the single given point?
أكثر...
from shapely.geometry import LineStringip = LineString([(0, 0), (0, 1), (1, 1)]).interpolate(1.5)print LineString([(0, 0), (0, 1), (1, 1)]).project(ip)> 1.5Now if I changed the polyline to fold back on itself it only returns 1 distance (the smallest distance), see the code below:
from shapely.geometry import LineStringip = LineString([(0, 0), (0, 1), (0, 0)]).interpolate(1.5)print LineString([(0, 0), (0, 1), (0, 0)]).project(ip)> 0.5In reality the answer to this question is 0.5 and 1.5.
My question is how do I get it to return all of the distances that may belong to the single given point?
أكثر...