Opened 13 years ago

Closed 13 years ago

Last modified 13 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 by strk, 13 years ago

See #1650 for a real world case

comment:2 by strk, 13 years ago

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.

in reply to:  description comment:3 by lrssvt, 13 years ago

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 by strk, 13 years ago

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

comment:5 by strk, 13 years ago

Resolution: fixed
Status: newclosed

in reply to:  4 comment:6 by lrssvt, 13 years ago

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.