ST_OrientedEnvelope returning parallelogram

Paul Ramsey pramsey at cleverelephant.ca
Fri Mar 8 14:22:46 PST 2024


Yep, that’s the answer, it’s an optical illusion. 

Here’s the pair in 4326, green is (non-square) input, red is (square) output



And here they are in 3857, same coloring, but now the input looks square and the output nonsquare.



P.



> On Mar 8, 2024, at 2:04 PM, Tom Payne <twpayne at gmail.com> wrote:
> 
> Riccardo's original data is in EPSG:4326 (I assume) but Riccardo's screenshot is in EPSG:3857 (geosjon.io <http://geosjon.io/>'s default). Could this be the reason?
> 
> On Fri, 8 Mar 2024 at 22:39, Paul Ramsey <pramsey at cleverelephant.ca <mailto:pramsey at cleverelephant.ca>> wrote:
>> 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 <mailto: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>
>> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20240308/e5a79a42/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PastedGraphic-2.png
Type: image/png
Size: 32449 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20240308/e5a79a42/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PastedGraphic-3.png
Type: image/png
Size: 30825 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20240308/e5a79a42/attachment-0001.png>


More information about the postgis-users mailing list