Opened 9 months ago

Closed 9 months ago

#5685 closed defect (fixed)

ST_Node('LINESTRING(0 0,0 0)') returns GEOMETRYCOLLECTION EMPTY

Reported by: strk Owned by: strk
Priority: medium Milestone: PostGIS 3.5.0
Component: postgis Version: master
Keywords: Cc:

Description

The GEOS counterpart of noding would return the input line untouched:

$ geosop node -a 'LINESTRING(0 0,0 0)'
MULTILINESTRING ((0 0, 0 0))

We must be turning to EMPTY on later steps (linemerge?)

Change History (6)

comment:1 by strk, 9 months ago

Confirmed it is the LineMerge step that turns the single-vertex line into an empty. It is fixed by PR https://git.osgeo.org/gitea/postgis/postgis/pulls/183

comment:2 by Sandro Santilli <strk@…>, 9 months ago

In 444fe40/git:

Debug GEOS geometries in lwgeom_noded

References #5685

comment:3 by Sandro Santilli <strk@…>, 9 months ago

In 8bfdce1/git:

Fix ST_Node with 1-vertex linestring

References #5685 in master branch

Includes unit test

comment:4 by strk, 9 months ago

Commit [8bfdce1c8577ccec4fe870c9a35c196b7dffe24c/git] fixed this specific case but single-vertex lines are still turned into empty if they are a component of a multilinestring. Even if the single-vertex line would split another line:

strk=# select st_astext(st_node('MULTILINESTRING((5 0,5 0),(20 0,10 0))'));
       st_astext       
-----------------------
 LINESTRING(20 0,10 0)
(1 row)

It doesn't seem correct

Note that the underlying GEOSNode does not even touch the input:

DEBUG:  [lwgeom_geos_node.c:lwgeom_node:167] Noded (GEOS): MULTILINESTRING ((5 0, 5 0), (20 0, 10 0))
DEBUG:  [lwgeom_geos_node.c:lwgeom_node:179] LineMerged (GEOS): LINESTRING (20 0, 10 0)

comment:5 by strk, 9 months ago

Owner: changed from pramsey to strk

comment:6 by strk, 9 months ago

Resolution: fixed
Status: newclosed

Declaring closed for now. The single collapsed line case is fixed.

Note: See TracTickets for help on using tickets.