ST_OrientedEnvelope returning parallelogram
Ricardo Mayerhofer
ricardo.ekm at gmail.com
Wed Mar 6 22:05:04 PST 2024
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.
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!
--
Ricardo Mayerhofer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20240307/7262aa0e/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot 2024-03-07 at 02.59.37.png
Type: image/png
Size: 406878 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20240307/7262aa0e/attachment.png>
More information about the postgis-users
mailing list