ST_OrientedEnvelope returning parallelogram
Paul Ramsey
pramsey at cleverelephant.ca
Fri Mar 8 10:45:49 PST 2024
If you take your polygon over to the GEOS project, this should be filed as an issue there.
Thanks,
P
> On Mar 8, 2024, at 10:35 AM, Ricardo Mayerhofer <ricardo.ekm at gmail.com> wrote:
>
> Thanks for the reply! This is my current PostGIS version:
>
> 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=https://cdn.proj.org <https://cdn.proj.org/> 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
>
> On Fri, Mar 8, 2024 at 3:30 PM Erik Wienhold <ewie at ewie.name <mailto:ewie at ewie.name>> wrote:
>> On 2024-03-07 07:05 +0100, Ricardo Mayerhofer wrote:
>> > I have a GIS application with multiple polygons where I'd like to get the
>> > rotated bounding box of the polygons. ST_OrientedEnvelope seems to be the
>> > right function, but in my case, is returning a parallelogram instead of a
>> > rectangle.
>> >
>> > I've created a simple example where the original polygon is a rectangle
>> > just to demonstrate the issue:
>> >
>> > CREATE TABLE geometries (
>> > geometry geometry
>> > );
>> > INSERT INTO geometries(geometry)
>> > values(ST_GeomFromText('POLYGON((-71.25961696926942
>> > 42.470522973159675,-71.25978846747648
>> > 42.470624424600906,-71.25973918365264
>> > 42.47066975346566,-71.25956768540266
>> > 42.47056830210077,-71.25961696926942 42.470522973159675))'))
>> > SELECT ST_AsGeoJson(st_collect(ST_OrientedEnvelope(geometry),
>> > geometry)) FROM geometries
>> >
>> > [image: Screenshot 2024-03-07 at 02.59.37.png]
>> >
>> > Image link:
>> > https://www.dropbox.com/scl/fi/xoi87e06mtfsnc1qzw3wu/oriented_2.png?rlkey=37ajuo6lwdnynk9gi8hpmoolq&dl=0
>> > <https://www.dropbox.com/scl/fi/xoi87e06mtfsnc1qzw3wu/oriented_2.png?rlkey=37ajuo6lwdnynk9gi8hpmoolq&dl=0>
>> >
>> > Any help is appreciated, thanks!
>>
>> What is your PostGIS and GEOS version? Please provide the output of
>>
>> SELECT postgis_full_version();
>>
>> I can confirm this bug on 3.4.1 with GEOS 3.12.0. Could be a regression
>> in GEOS 3.12.0:
>>
>> "CAPI: GEOSMinimumRotatedRectangle now uses MinimumAreaRectangle (Paul Ramsey)" [1]
>>
>> [1] https://github.com/libgeos/geos/blob/main/NEWS.md#changes-in-3120
>>
>> --
>> Erik
>
>
> --
> Ricardo Mayerhofer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20240308/0f9c934d/attachment.htm>
More information about the postgis-users
mailing list