I use Shapely and I've run into an issue where I can find the intersection of two lines. However once I have the intersection point, I don't seem to be able and cross-reference that it belongs in both lines.
from shapely.geometry import Point, LineString # Test two lines l1 = LineString([(0, 300), (999, 300)]) l2 = LineString([(379, 250), (450, 320)]) point = l1.intersection(l2) assert point.intersects(l1) # True assert point.intersects(l2) # False
I wonder if this is a rounding issue? And in such a case how can I get around it? I.e. if I have a point, how can I guarantee that the point is in the line with an error of say 2 decimals?