<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">Le 21/01/2025 à 11:37, Thomas Knudsen
via gdal-dev a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:CAH0YoEMQ0G+GtFj4YCT7vsaPx_dyN58Zz_99HdSqbBbs99OM6w@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">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.</div>
</blockquote>
<p>actually no need to do the explicit conversion to geographical
coordinates, if the appropriate SRS is attached to your geometry,
OGRGeometry::<span class="w"></span><span
class="sig-name descname"><span class="n"><span class="pre">get_GeodesicLength</span></span></span><span
class="sig-paren">() will do the right thing:</span>
<a class="moz-txt-link-freetext" href="https://gdal.org/en/stable/api/ogrgeometry_cpp.html#_CPPv4NK13OGRLineString18get_GeodesicLengthEPK19OGRSpatialReference">https://gdal.org/en/stable/api/ogrgeometry_cpp.html#_CPPv4NK13OGRLineString18get_GeodesicLengthEPK19OGRSpatialReference</a></p>
<p>Python API:
<a class="moz-txt-link-freetext" href="https://gdal.org/en/stable/api/python/vector_api.html#osgeo.ogr.Geometry.GeodesicLength">https://gdal.org/en/stable/api/python/vector_api.html#osgeo.ogr.Geometry.GeodesicLength</a></p>
<p>Python examples:
<a class="moz-txt-link-freetext" href="https://github.com/OSGeo/gdal/blob/master/autotest/ogr/ogr_geom.py#L4560">https://github.com/OSGeo/gdal/blob/master/autotest/ogr/ogr_geom.py#L4560</a></p>
<span style="white-space: pre-wrap">
</span>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</body>
</html>