Opened 4 years ago
Closed 4 years ago
#4881 closed defect (fixed)
Lineal TopoGeometry objects loose their direction upon casting to Geometry
Reported by: | strk | Owned by: | strk |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 3.2.0 |
Component: | topology | Version: | 1.5.X |
Keywords: | Cc: |
Description
Simple testcase:
SELECT CreateTopology('t'); CREATE TABLE t.f(i serial primary key); SELECT AddTopoGeometryColumn('t','t','f','g','LINE'); SELECT ST_AsText(toTopoGeom('LINESTRING(0 0, 10 0)', 't', 1, 0)::geometry); select ST_AsText(toTopoGeom(ST_Reverse('LINESTRING(0 0, 10 0)'), 't', 1, 0)::geometry);
The last two queries are creating a TopoGeometry with two LINESTRING objects in opposite direction. When casting these two objects back to a GEOMETRY object the _same_ LINESTRING comes back, regardless of the original direction.
I verified this is NOT a problem with toTopoGeom but with the cast to geometry, because changing the sign of the element_id in the relation table does NOT change the output of the ::geometry cast.
This limitation is probably as old as the Topology support in PostGIS.
MULTILINESTRING((0 0,10 0))
Change History (6)
comment:1 by , 4 years ago
comment:2 by , 4 years ago
Summary: | Lineal TopoGeometry objects do not conserve their direction → Lineal TopoGeometry objects do not preserve their direction |
---|
A related ticket is about GetTopoGeomElements NOT returning the sign of elements: #4882
comment:3 by , 4 years ago
I spoke too early: while the TopoGeometry::Geometry cast IS BOGUS as verified by manually changing sign of the element_id
fields in the relation
table, the toTopoGeom function is ALSO BOGUS in that it doesn't correctly set those element_id
field signs, see #4884
comment:4 by , 4 years ago
Summary: | Lineal TopoGeometry objects do not preserve their direction → Lineal TopoGeometry objects loose their direction upon casting to Geometry |
---|
comment:5 by , 4 years ago
Milestone: | PostGIS 3.1.2 → PostGIS 3.2.0 |
---|
Work in progress: https://gitlab.com/postgis/postgis/-/merge_requests/23