Opened 4 years ago

Last modified 4 years ago

#4886 new defect

ST_Normalize() has different behavior with GEOS < 3.9.0 and => 3.9.0

Reported by: strk Owned by: pramsey
Priority: medium Milestone: PostGIS GEOS
Component: postgis Version:
Keywords: Cc:

Description

ST_Normalize('LINESTRING(2 8,2 2,8 2,8 8,2 8)'::geometry)

The above query gives a different result in GEOS-3.8 or earlier and GEOS-3.9 or later. In the first case (older GEOS) the LINESTRING is returned untouched, while in the second case (GEOS-3.9.0+) is returned changed in winding to become clockwise.

As ST_Normalize is used to avoid these kind of differences across versions this is, I think, and unwanted behavioural change.

I do understand we might want to ensure a winding direction for closed Linestrings, but maybe it should be a user choice to decide whether or not to do that, given not all GEOS versions support it ? Maybe we should do the reordering in PostGIS to be immune of behavioural changes

Change History (3)

comment:2 by strk, 4 years ago

If we consider the "untouched linestring" as a GEOS bug, we could easily workaround the bug by (in case GEOS < 3.9.0) creating a Polygon out of a closed linestring, normalizing it and picking its boundary after normalization. I've tested this to work effectively on my client code.

Note: See TracTickets for help on using tickets.