I just made a shapely Linestring with multiple points of GPS coordinate, and I want the total length in meters.
Exemple of coordinates : [ -0.113623333333333, 44.911787333333336 ]
How can i achieve that?
I just made a shapely Linestring with multiple points of GPS coordinate, and I want the total length in meters.
Exemple of coordinates : [ -0.113623333333333, 44.911787333333336 ]
How can i achieve that?
You can use pyproj
to measure geodesic line length.
>>> from pyproj import Geod
>>> from shapely.geometry import Point, LineString
>>> line_string = LineString([Point(1, 2), Point(3, 4)]))
>>> geod = Geod(ellps="WGS84")
>>> total_length = geod.geometry_length(line_string)
>>> f"{total_length:.3f}"
'313588.397'
See more in the documentation: https://pyproj4.github.io/pyproj/stable/examples.html#geodesic-line-length