I am using GeoSeries.distance
to calculate the distance between a point and a linestring in a projected coordinate system. How does Geopandas calculate this distance? What is the logic behind the function? Is it the perpendicular distance of the point to the line? What if the perpendicular is only feasible on the line extension? Does python extend the line?
-
It's computing intersection point between line segment (2 sequential vertices) and perpendicular from point. Shortest distance is distance in question. If no intersection found, it's distance to nearest end of line.– FelixIPCommented May 16, 2023 at 0:13
Add a comment
|
1 Answer
geopandas uses shapely under the hood. Distance in shapely Returns the minimum distance (float) to the other geometric object.
So it is the euclidean distance from the point to the nearest point on the linestring.