Opened 9 months ago
Closed 9 months ago
#5725 closed defect (fixed)
Undocumented st_offsetcurve behaviour change between 3.2 and 3.3
Reported by: | gbartonowenstl | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS GEOS |
Component: | postgis | Version: | 3.3.x |
Keywords: | offsetcurve, release notes, st_offsetcurve, reversing | Cc: | gbartonowenstl |
Description (last modified by )
I've read all the release notes and searched the internet generally for this but I cannot find anything.
It appears that between 3.2 and 3.3, st_offsetcurve started reversing the curves when a negative offset was given (the documented behaviour), where as previously it did not.
Reproduction SQL:
select PostGIS_Version(), st_startpoint(geom), st_startpoint(st_offsetcurve(geom, -0.1)), st_distance(st_startpoint(geom), st_startpoint(st_offsetcurve(geom, -0.1))) from (values (st_geomfromtext('LINESTRING (2302997.443737494 116854.4859950367, 2303083.234236186 117132.01622010056)',2163))) as vals (geom)
One env:
3.3 USE_GEOS=1 USE_PROJ=1 USE_STATS=1 POINT (2302997.443737494 116854.4859950367) POINT (2303083.3297756314 117131.98668682482) 290.48759954576633
Older env:
3.2 USE_GEOS=1 USE_PROJ=1 USE_STATS=1 POINT (2302997.443737494 116854.4859950367) POINT (2302997.5392769394 116854.45646176096) 0.10000000013339401
I think this is due to a geos change: https://github.com/dr-jts/geos/commit/7561b50f943305b1419bd655e10e7dcad2cb9492
I'd say this was mostly a bug in the documentation/release notes but I suspect it will cause subtle sadness for many
Change History (6)
comment:1 by , 9 months ago
Description: | modified (diff) |
---|
comment:2 by , 9 months ago
Milestone: | PostGIS 3.3.7 → PostGIS GEOS |
---|
comment:3 by , 9 months ago
I agree its sort of a nightmare scenario, but I can't help but think that it does count as postgis behaviour changing in an undocumented way given the user doesn't necessarily know or control their geos version.
It's, as far as I can see, quite difficult to work around it in an efficient way without interrogating the GEOS version and altering the query, and a breaking change for relatively common use cases.
comment:4 by , 9 months ago
This change happened in GEOS 3.11 with the switch to an improved offset curve algorithm.
I'll add a GEOS NEWS note about this being a change in behaviour, so it will be captured going forward.
The PostGIS doc for ST_OffsetCurve
should be updated to reflect this changed behaviour.
We generally don't state changes in behavior caused my geos, since the versions aren't aligned in any way. So you can't simply say as of GEOS xxx this might change because we have no idea what version of GEOS people will be running. For example PostGIS 3.2 and 3.3 are both compatible with GEOS 3.6 and higher and sadly many people are running on 3.6-3.8 and this change you are talking about came in GEOS 3.12.
I agree though the GEOS NEWs should have highlighted this reqression in behavior, which it looks like it didn't, so perhaps an unintentional regression.