Opened 3 years ago
Closed 2 years ago
#5089 closed defect (fixed)
ST_Reverse does not handle CURVEPOLYGON/COMPOUNDCURVE correctly
Reported by: | bhoefling | Owned by: | strk |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 3.3.0 |
Component: | liblwgeom | Version: | 3.2.x |
Keywords: | Cc: | bhoefling |
Description
ST_Reverse works for CIRCULARSTRING, and for simple CURVEPOLYGON.
But if the CURVEPOLYGON contains a COMPOUNDCURVE with more than one component, the reverse order is wrong.
Testcase is from here:
Actual Result:
SELECT 'cplg2', ST_AsText(ST_Reverse('CURVEPOLYGON (COMPOUNDCURVE (CIRCULARSTRING (0 0,1 1,1 0),(1 0,0 1),(0 1,0 0)))'::geometry));
?column? | st_astext
cplg2 | CURVEPOLYGON(COMPOUNDCURVE(CIRCULARSTRING(1 0,1 1,0 0),(0 1,1 0),(0 0,0 1)))
(1 row)
Note that each sub-component is reversed. But it is necessary to additionally reverse the order of the components as such. Otherwise, the end/start nodes don't match any more.
EXPECTED:
CURVEPOLYGON(COMPOUNDCURVE((0 0,0 1), (0 1,1 0), CIRCULARSTRING(1 0,1 1,0 0)))
Implementation details: lwgeom.c, lwgeom_reverse_in_place(LWGEOM *geom)
This CASE needs to be differentiated more.
Tested on Docker postgis/postgis:13-master
SELECT postgis_full_version();
-- POSTGIS="3.3.0dev 3.2.0-398-g4fa57df0b" [EXTENSION] PGSQL="130" GEOS="3.11.0dev-CAPI-1.16.0" PROJ="8.2.0" LIBXML="2.9.10" LIBJSON="0.15" LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)" (core procs from "3.1.4 ded6c34" need upgrade)
SELECT version();
version
PostgreSQL 13.5 (Debian 13.5-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
Björn
Change History (4)
comment:1 by , 3 years ago
Cc: | added |
---|
comment:2 by , 3 years ago
comment:4 by , 2 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
For reference, here is an older bug that fixed the CURVESTRING case:
https://trac.osgeo.org/postgis/ticket/2411
https://trac.osgeo.org/postgis/changeset/15566