Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#1654 closed defect (fixed)

Lines added to topology with a tolerance don't get snapped to isolated nodes

Reported by: strk Owned by: strk
Priority: medium Milestone: PostGIS 2.0.0
Component: topology Version: 2.0.x
Keywords: Cc:

Description

See this session:

SELECT CreateTopology('tt');
SELECT ST_AddIsoNode('tt', 0, 'POINT(0 0)');
SELECT TopoGeo_addLineString('tt', 'LINESTRING(-10 1, 10 1)', 2);
SELECT TopologySummary('tt');

The linestring is at distance=1 from the point, should be snapped to it since we request tolerance=2.

Debugging:

strk=# SELECT TopoGeo_addLineString('tt', 'LINESTRING(-10 1, 10 1)', 2);
DEBUG:  Self-noded: LINESTRING(-10 1,10 1)
DEBUG:  WITH nearby AS ( SELECT e.geom FROM tt.edge e WHERE ST_DWithin(e.geom, '01020000000200000000000000000024C0000000000000F03F0000000000002440000000000000F03F'::geometry, 2) ) SELECT st_collect(geom) FROM nearby;
DEBUG:  WITH nearby AS ( SELECT n.geom FROM tt.node n WHERE ST_DWithin(n.geom, '01020000000200000000000000000024C0000000000000F03F0000000000002440000000000000F03F'::geometry, 2) ) SELECT (st_dump(st_unaryunion(st_collect(geom)))).geom FROM nearby;
DEBUG:  Split by POINT(0 0): MULTILINESTRING((-10 1,10 1))

So the code does realize it should _split_ the line, but fails at doing it because the point is not _on_ the line, a snap should fix.

Change History (6)

comment:1 Changed 6 years ago by strk

See #1650 for a real world case

comment:2 Changed 6 years ago by strk

Summary: Lines added to topology with a tolerance don't get properly snappedLines added to topology with a tolerance don't get snapped to isolated nodes

Alright I think they key here is about a missing snap to _isolated_ nodes, because all other nodes would be a snap target already being part of edges.

comment:3 in reply to:  description Changed 6 years ago by lrssvt

Replying to strk:

.... a snap should fix.

IMHO, if I understand correctly, it is right!

I added a line:

LINESTRING(-3 1,6 1)

then a point:

POINT(3 2)

and st_snap function returns:

LINESTRING(-3 1,3 2,6 1)

comment:4 Changed 6 years ago by strk

Yeah, fixed by r9409, and added your name to the NEWS file :)

comment:5 Changed 6 years ago by strk

Resolution: fixed
Status: newclosed

comment:6 in reply to:  4 Changed 6 years ago by lrssvt

Replying to strk:

Yeah, fixed by r9409, and added your name to the NEWS file :)

Good NEWS! Thanks!

Note: See TracTickets for help on using tickets.