Le 21/01/2025 à 11:37, Thomas Knudsen via gdal-dev a écrit :
If you plan to transform to a different system anyway, I would definitely prefer going to geographical coordinates, and computing the length of the geodesic between the two points.

actually no need to do the explicit conversion to geographical coordinates, if the appropriate SRS is attached to your geometry, OGRGeometry::get_GeodesicLength() will do the right thing: https://gdal.org/en/stable/api/ogrgeometry_cpp.html#_CPPv4NK13OGRLineString18get_GeodesicLengthEPK19OGRSpatialReference

Python API: https://gdal.org/en/stable/api/python/vector_api.html#osgeo.ogr.Geometry.GeodesicLength

Python examples: https://github.com/OSGeo/gdal/blob/master/autotest/ogr/ogr_geom.py#L4560

--
http://www.spatialys.com
My software is free, but my time generally not.
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to