<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>Hi, thanks again for the explanation</p>
<p><br>
</p>
<p>I uploaded the tif file I was trying to render here: <a href="https://www.virtual-winds.org/maitai/gebco.tif" class="OWAAutoLink" id="LPlnk15614" previewremoved="true">
https://www.virtual-winds.org/maitai/gebco.tif</a></p>
<p><br>
</p>
<p><span style="font-size: 12pt;">The thing that worries me is that it is the first case since we upgraded to 3.4.1 a quite a while ago,
</span><span style="font-size: 12pt;">and </span><span style="font-size: 12pt;">I am wondering how it can work for all other tif dataset</span><span style="font-size: 12pt;">s </span><span style="font-size: 12pt;">we are using. I tested a few with this modification </span><span style="font-size: 12pt;">and
 nothing seems broken, so it seems OK.</span><br>
</p>
<p><span style="font-size: 12pt;"><br>
</span></p>
<p><span style="font-size: 12pt;">--Philippe</span></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 3:45 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,<br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial">According to the migration guide, this is only relevant for
<span class="font" style="font-family:menlo,consolas,monospace,sans-serif">OSRImportFromEPSG</span>,
<span class="font" style="font-family:menlo,consolas,monospace,sans-serif">SetWellKnownGeogCS</span> and
<span class="font" style="font-family:menlo,consolas,monospace,sans-serif">SetFromUserInput</span>. But then again, you were using the equivalent of
<span class="font" style="font-family:menlo,consolas,monospace,sans-serif">OSRImportFromWkt</span>.<br>
</div>
<div style="font-family:Arial"><br>
</div>
<div style="font-family:Arial">I never noticed any issues when using spatial references loaded from existing rasters, but you might want to test. I tried loading the
<span class="font" style="font-family:menlo,consolas,monospace,sans-serif">SpatialReference</span> from a NetCDF produced by GDAL 2.3.2, under the (verified) assumption that it will contain the SRS without the AXIS nodes. But GDAL 3.5.1 still seems to use the
 traditional order for these.<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 15:39, 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>Thanks very much, I would never have figured that out myself.<br>
</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 ?<br>
</p>
<p><br>
</p>
<p>--Philippe <br>
</p>
<div><br>
</div>
<div><br>
</div>
<div style="color:rgb(0,0,0)">
<div>
<hr style="display:inline-block; width:98%">
<br>
</div>
<div id="qt-divRplyFwdMsg" dir="ltr">
<div><span class="font" style="font-family:Calibri,sans-serif"><span class="colour" style="color:rgb(0,0,0)"><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</span></span></div>
<div> <br>
</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="LPlnk692050" 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="LPlnk72986" previewremoved="true">
https://github.com/OSGeo/gdal/blob/v3.5.0/MIGRATION_GUIDE.TXT#L67</a> (calling <span class="qt-font" style="">
<span class="font" style="font-family:menlo,consolas,monospace,sans-serif">SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER)</span></span> on every
<span class="qt-font" style=""><span class="font" style="font-family:menlo,consolas,monospace,sans-serif">OGRSpatialReference</span></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-qt" style="">
<div id="qt-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>
<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>