<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body><div style="font-family:Helvetica,Arial;font-size:13px; ">Thank you everyone for the responses, and Even for the bug fix.</div><div style="font-family:Helvetica,Arial;font-size:13px; "><br></div><div style="font-family:Helvetica,Arial;font-size:13px; "><div style="margin: 0px;">Best regards,</div><div style="margin: 0px;"><br></div><div style="margin: 0px;">Robin</div></div> <br> <div class="gmail_signature"></div> <br><p class="airmail_on">On 29 March 2022 at 22:33:49, Even Rouault (<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>) wrote:</p> <blockquote type="cite" class="clean_bq"><span><div><div></div><div>
<p>Was a bug. Fix queued in <a class="moz-txt-link-freetext" href="https://github.com/OSGeo/gdal/pull/5543">https://github.com/OSGeo/gdal/pull/5543</a><br>
</p>
<div class="moz-cite-prefix">Le 29/03/2022 à 22:30, Robin Wilson a
écrit :<br>
</div>
<blockquote type="cite" cite="mid:etPan.62436c60.7fabac2d.a67@rtwilson.com">
<div>Hi,</div>
<div><br>
</div>
<div>I’ve been running into problems creating STAC items for
images that cross the antimeridian. The geometries for the
images are coming out as spanning the width of the whole world
(from -180 to +180 degrees). With the help of the author of the
tool I was using to create the STAC items (rio-stac), I’ve
narrowed it down to a simple test case of reprojecting
geometries (which is what the tool is doing internally).</div>
<div><br>
</div>
<div>If you put the following GeoJSON for an antimeridian-crossing
polygon in WGS 84 / UTM zone 1N in a file called
test_32601.geojson:</div>
<div><br>
</div>
<div>```</div>
<div>
<div>{"type":"Polygon","coordinates":[[[377120,7577600],[418080,7577600],[418080,7618560],[377120,7618560],[377120,7577600]]]}</div>
<div>```</div>
<div><br>
</div>
<div>and then run the following:</div>
<div><br>
</div>
<div>```</div>
<div>
<div>ogr2ogr -f GeoJSON -s_srs epsg:32601 -t_srs epsg:4326
out_4326.geojson test_32601.geojson</div>
</div>
<div>```</div>
<div><br>
</div>
<div>The contents of the output file will be:</div>
<div><br>
</div>
<div>```</div>
<div>{ "type": "Polygon", "coordinates": [ [ [
-179.018099960087909, 68.666857319910392 ], [
-178.985579869598382, 68.299719485120988 ], [
-179.976982644969041, 68.284942315413858 ], [
179.974309855567753, 68.651801088224246 ], [ 180.0,
68.652259945574556 ], [ 180.0, 68.652259945541758 ], [ 180.0,
68.652259944541754 ], [ -180.0, 68.652259944541754 ], [
-180.0, 68.652259945541758 ], [ -180.0, 68.652259945610126 ],
[ -179.018099960087909, 68.666857319910392 ] ] ] }</div>
<div>```</div>
<div><br>
</div>
<div>In that output geometry there are longitudes of 180 and
-180, so when plotted on a map it spans the whole width of the
world.</div>
<div><br>
</div>
<div>The author of the rio-stac library did a PR to try and fix
this problem (<a href="https://github.com/developmentseed/rio-stac/pull/30" moz-do-not-send="true" class="moz-txt-link-freetext">https://github.com/developmentseed/rio-stac/pull/30</a>),
but it doesn’t seem to have fixed it for this example, as the
underlying GDAL code used by his library (through rasterio, I
believe) is giving this result.</div>
<div><br>
</div>
<div>I find this result unexpected, but I have no knowledge of
how GDAL deals with the antimeridian. Is this to be expected,
or is this potentially a bug? If it isn’t a bug, is there any
way around this?</div>
<div><br>
</div>
<div>
<div>Best regards,</div>
<div><br>
</div>
<div>Robin</div>
</div>
<div><br>
</div>
<div>Dr Robin Wilson</div>
<div><a href="http://www.rtwilson.com" moz-do-not-send="true">www.rtwilson.com</a></div>
<div><br>
</div>
</div>
<br>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
</blockquote>
<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>
</div></div></span></blockquote></body></html>