ST_OrientedEnvelope returning parallelogram

Martin Davis mtnclimb at gmail.com
Fri Mar 8 11:36:05 PST 2024


I can't reproduce this with GEOS 3.12 (either via PostGIS
ST_OrientedEnvelope or natively in GEOS).  The output is rectangular and as
expected.

SELECT ST_AsText(ST_OrientedEnvelope('POLYGON((-71.25961696926942
42.470522973159675,-71.25978846747648 42.470624424600906,-71.25973918365264
42.47066975346566,-71.25956768540266 42.47056830210077,-71.25961696926942
42.470522973159675))'));

                  st_astext
--------------------------------------------------------------------------------------------------------------------------------------------------
 POLYGON((-71.25975582815524 42.470679599674035,-71.25956768540266
42.47056830210077,-71.25960032476851 42.4705131269523,-71.25978846752108
42.47062442452555,-71.25975582815524 42.470679599674035))

bin/geosop -a "POLYGON((-71.25961696926942
42.470522973159675,-71.25978846747648 42.470624424600906,-71.25973918365264
42.47066975346566,-71.25956768540266 42.47056830210077,-71.25961696926942
42.470522973159675))" minAreaRectangle

POLYGON ((-71.25975582815524 42.470679599674035, -71.25956768540266
42.47056830210077, -71.25960032476851 42.4705131269523, -71.25978846752108
42.470624424525546, -71.25975582815524 42.470679599674035))

[image: image.png]

Is it possible the OP diagram is misleading?  Hard to tell since the full
output is not available.

@Erik: your repro is surprising. Can you post your query with output, and
the postgis_full_version() ?

On Fri, Mar 8, 2024 at 9:47 AM Ricardo Mayerhofer <ricardo.ekm at gmail.com>
wrote:

> Hi all,
> 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.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20240308/e5c3247e/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 52741 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20240308/e5c3247e/attachment.png>


More information about the postgis-users mailing list