<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Thanks very much, I would never have figured that out myself.</p>
<p><br>
</p>
<p>Just to make it clear I should add this flag on all OGRSpatialReference or only when it is loaded with importFromWkt ?</p>
<p><br>
</p>
<p>--Philippe </p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> gdal-dev <gdal-dev-bounces@lists.osgeo.org> on behalf of LaurenČ›iu Nicola via gdal-dev <gdal-dev@lists.osgeo.org><br>
<b>Sent:</b> Tuesday, October 18, 2022 1:01 PM<br>
<b>To:</b> gdal-dev@lists.osgeo.org<br>
<b>Subject:</b> Re: [gdal-dev] Problem with coordinate transformation</font>
<div> </div>
</div>
<div>
<div style="font-family:Arial">Hi Philippe,<br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial">The new behaviour is correct. See <a href="https://gdal.org/development/rfc/rfc73_proj6_wkt2_srsbarn.html#axis-order-issues" id="LPlnk123463" previewremoved="true">
https://gdal.org/development/rfc/rfc73_proj6_wkt2_srsbarn.html#axis-order-issues</a> for the axis order issue, a change made in GDAL 3.0. You can find a solution in
<a href="https://github.com/OSGeo/gdal/blob/v3.5.0/MIGRATION_GUIDE.TXT#L67" id="LPlnk321124" previewremoved="true">
https://github.com/OSGeo/gdal/blob/v3.5.0/MIGRATION_GUIDE.TXT#L67</a> (calling <span class="font" style="font-family:menlo,consolas,monospace,sans-serif">
SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER)</span> on every <span class="font" style="font-family:menlo,consolas,monospace,sans-serif">
OGRSpatialReference</span> you use.<br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial">Laurentiu<br>
</div>
<div style="font-family:Arial"><br>
</div>
<div>On Tue, Oct 18, 2022, at 13:43, Philippe Lelong wrote:<br>
</div>
<blockquote type="cite" id="qt" style="">
<div id="qt-divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif">
<p>Hi,<br>
</p>
<p><br>
</p>
<p>I have an app build against GDAL 3.4.1 and PROJ6, and the same app build against GDAL 2.1.3 and PROJ4. They are not giving the same result when using OGRCoordinateTransformation.<br>
</p>
<p><br>
</p>
<p>If I do<br>
</p>
<p><br>
</p>
<p><br>
</p>
<pre style="margin-top:0px; margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">const</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">char</span><span style="color:rgb(192,192,192)"> </span>*<span style="color:rgb(9,46,100)">their</span><span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"GEOGCS[\"WGS</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433],AUTHORITY[\"EPSG\",\"4326\"]]"</span>;<br></pre>
<pre style="margin-top:0px; margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">const</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">char</span><span style="color:rgb(192,192,192)"> </span>*<span style="color:rgb(9,46,100)">our</span><span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"+proj=longlat</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">+datum=WGS84</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">+ellps=WGS84</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">+no_defs</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">+over"</span>;<br></pre>
<pre style="margin-top:0px; margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">double</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">miX</span><span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span>-<span style="color:rgb(0,0,128)">17.4042</span>;<br></pre>
<pre style="margin-top:0px; margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">double</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">miY</span><span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">35.3333</span>;<br></pre>
<pre style="margin-top:0px; margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">OGRSpatialReference</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">theirReference</span>;<br></pre>
<pre style="margin-top:0px; margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(9,46,100)">theirReference</span>.<span style="color:rgb(0,103,124)">importFromWkt</span>((<span style="color:rgb(128,128,0)">char</span>**)&<span style="color:rgb(9,46,100)">their</span>);<br></pre>
<pre style="margin-top:0px; margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">OGRSpatialReference</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(9,46,100)">ourReference</span>;<br></pre>
<pre style="margin-top:0px; margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(9,46,100)">ourReference</span>.<span style="color:rgb(0,103,124)">importFromProj4</span>(<span style="color:rgb(9,46,100)">our</span>);<br></pre>
<pre style="margin-top:0px; margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">OGRCoordinateTransformation</span><span style="color:rgb(192,192,192)"> </span>*<span style="color:rgb(9,46,100)">trans</span><span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,103,124)">OGRCreateCoordinateTransformation</span>(&<span style="color:rgb(9,46,100)">theirReference</span>,<span style="color:rgb(192,192,192)"> </span>&<span style="color:rgb(9,46,100)">ourReference</span>);<br></pre>
<pre style="margin-top:0px; margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(9,46,100)">trans</span>-><span style="color:rgb(0,103,124)">Transform</span>(<span style="color:rgb(0,0,128)">1</span>,<span style="color:rgb(192,192,192)"> </span>&<span style="color:rgb(9,46,100)">miX</span>,<span style="color:rgb(192,192,192)"> </span>&<span style="color:rgb(9,46,100)">miY</span>);<br></pre>
<pre style="margin-top:0px; margin-bottom:0px"><br></pre>
<div>in the version build against GDAL 3.4.1/PROJ6 this code results in swapping miX and miY (i.e. miX = 35.3333 and miY = -17.4042)
<br>
</div>
<p><br>
</p>
<p>The version build against GDAL 2.1.3/PROJ4 leaves miX and miY unchanged, which I believe is correct.<br>
</p>
<p><br>
</p>
<p>Any explanation for this behavior and which one is correct? Would I get the same result using PROJ8 ?<br>
</p>
<p><br>
</p>
<p>Thanks in advance<br>
</p>
<p>Philippe Lelong<br>
</p>
<p><br>
</p>
<p><br>
</p>
</div>
<div>_______________________________________________<br>
</div>
<div>gdal-dev mailing list<br>
</div>
<div><a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
</div>
<div><a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</div>
<div><br>
</div>
</blockquote>
<div style="font-family:Arial"><br>
</div>
</div>
</div>
</div>
</body>
</html>