ST_OrientedEnvelope returning parallelogram

Paul Ramsey pramsey at cleverelephant.ca
Fri Mar 8 13:39:18 PST 2024


I’m seeing the same thing as Martin, the output is rectangular. I see it using the JTS test builder. I see it using QGIS.

This is the output, same as you get:

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

It is a rectangle. You can confirm by checking the angle between the first two edges.

select degrees(st_angle('LINESTRING(-71.25975582815524 42.470679599674035,-71.25956768540266 42.47056830210077)', 'LINESTRING(-71.25956768540266 42.47056830210077,-71.25960032476851 42.4705131269523)'));

Which is 90 degrees.

P.

> On Mar 8, 2024, at 1:29 PM, Erik Wienhold <ewie at ewie.name> wrote:
> 
> On 2024-03-08 21:40 +0100, Martin Davis wrote:
>> Why do you think this result is wrong?
> 
> Because I see that the resulting geometry is a parallelogram, as
> reported by Ricardo.
> 
>> It's the same as the result I'm seeing, and is an oriented rectangle
>> enclosing the input (apart from minor issues with numerical
>> precision).
> 
> Are we seeing the same rendering?  Your PostGIS and geosop outputs are
> the same as mine.  And I'm wondering where you got that rendering[1]
> from that you've attached in your initial reply.  It shows a
> parallelogram in blue as input and the correct oriented envelope in red
> as result.  But it's not even the same parallelogram that Ricardo is
> reporting.  Where did you get that input from?
> 
> I attached the rendering of the input and output geometries that I got.
> The geometries look identical to what Ricardo showed.
> 
> [1] https://lists.osgeo.org/pipermail/postgis-users/attachments/20240308/e5c3247e/attachment.png
> 
> -- 
> Erik
> <img.png>



More information about the postgis-users mailing list