<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">If you take your polygon over to the GEOS project, this should be filed as an issue there.<div>Thanks,</div><div>P<br><div><br><blockquote type="cite"><div>On Mar 8, 2024, at 10:35 AM, Ricardo Mayerhofer <ricardo.ekm@gmail.com> wrote:</div><br class="Apple-interchange-newline"><div><div dir="ltr">Thanks for the reply! This is my current PostGIS version:<div><br></div><div><pre style="font-family: "JetBrains Mono", monospace; font-size: 9.8pt;">POSTGIS="3.4.0 0874ea3" [EXTENSION] PGSQL="150" GEOS="3.11.2-CAPI-1.17.2" PROJ="8.0.1 NETWORK_ENABLED=OFF URL_ENDPOINT=<a href="https://cdn.proj.org/">https://cdn.proj.org</a> USER_WRITABLE_DIRECTORY=/tmp/proj DATABASE_PATH=/rdsdbbin/postgres-15.5.R1/share/proj/proj.db" GDAL="GDAL 3.4.3, released 2022/04/22" LIBXML="2.9.1" LIBJSON="0.15" LIBPROTOBUF="1.3.2" WAGYU="0.5.0 (Internal)" TOPOLOGY RASTER</pre></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 8, 2024 at 3:30 PM Erik Wienhold <<a href="mailto:ewie@ewie.name">ewie@ewie.name</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 2024-03-07 07:05 +0100, Ricardo Mayerhofer wrote:<br>
> I have a GIS application with multiple polygons where I'd like to get the<br>
> rotated bounding box of the polygons. ST_OrientedEnvelope seems to be the<br>
> right function, but in my case, is returning a parallelogram instead of a<br>
> rectangle.<br>
> <br>
> I've created a simple example where the original polygon is a rectangle<br>
> just to demonstrate the issue:<br>
> <br>
> CREATE TABLE geometries (<br>
>   geometry geometry<br>
> );<br>
> INSERT INTO geometries(geometry)<br>
> values(ST_GeomFromText('POLYGON((-71.25961696926942<br>
> 42.470522973159675,-71.25978846747648<br>
> 42.470624424600906,-71.25973918365264<br>
> 42.47066975346566,-71.25956768540266<br>
> 42.47056830210077,-71.25961696926942 42.470522973159675))'))<br>
> SELECT ST_AsGeoJson(st_collect(ST_OrientedEnvelope(geometry),<br>
> geometry)) FROM geometries<br>
> <br>
> [image: Screenshot 2024-03-07 at 02.59.37.png]<br>
> <br>
> Image link:<br>
>  <a href="https://www.dropbox.com/scl/fi/xoi87e06mtfsnc1qzw3wu/oriented_2.png?rlkey=37ajuo6lwdnynk9gi8hpmoolq&dl=0" rel="noreferrer" target="_blank">https://www.dropbox.com/scl/fi/xoi87e06mtfsnc1qzw3wu/oriented_2.png?rlkey=37ajuo6lwdnynk9gi8hpmoolq&dl=0</a><br>
> <<a href="https://www.dropbox.com/scl/fi/xoi87e06mtfsnc1qzw3wu/oriented_2.png?rlkey=37ajuo6lwdnynk9gi8hpmoolq&dl=0" rel="noreferrer" target="_blank">https://www.dropbox.com/scl/fi/xoi87e06mtfsnc1qzw3wu/oriented_2.png?rlkey=37ajuo6lwdnynk9gi8hpmoolq&dl=0</a>><br>
> <br>
> Any help is appreciated, thanks!<br>
<br>
What is your PostGIS and GEOS version?  Please provide the output of<br>
<br>
        SELECT postgis_full_version();<br>
<br>
I can confirm this bug on 3.4.1 with GEOS 3.12.0.  Could be a regression<br>
in GEOS 3.12.0:<br>
<br>
        "CAPI: GEOSMinimumRotatedRectangle now uses MinimumAreaRectangle (Paul Ramsey)" [1]<br>
<br>
[1] <a href="https://github.com/libgeos/geos/blob/main/NEWS.md#changes-in-3120" rel="noreferrer" target="_blank">https://github.com/libgeos/geos/blob/main/NEWS.md#changes-in-3120</a><br>
<br>
-- <br>
Erik<br>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Ricardo Mayerhofer</div>
</div></blockquote></div><br></div></body></html>