pgrouting icon indicating copy to clipboard operation
pgrouting copied to clipboard

pgr_nodeNetwork does not correctly split line segments

Open mhugo opened this issue 9 years ago • 11 comments

pgr_nodeNetwork does not cut intersections on intersecting points. Consider the following simple case of two segments crossing on (5,5) :

create table network (id int, the_geom geometry(linestring) );
insert into network values (1, 'linestring(0 0, 10 10)'::geometry);
insert into network values (2, 'linestring(2 0, 8 10)'::geometry);
select pgr_nodeNetwork('network', 0.001);

The "network_noded" table then contains 4 geometries : LINESTRING(0 0,1 1) <-- the first segment split on what seems to be the projection of the starting point of the second segment (?) LINESTRING(1 1,9 9) <-- split on the projection of the ending point of the second segment LINESTRING(9 9,10 10) LINESTRING(2 0,8 10) <-- the original second segment

It should split the two geometries on (5,5)

mhugo avatar Nov 18 '14 20:11 mhugo

I have found the problem. Change in pull #282 solves the example correctly.

yobiSource avatar Dec 03 '14 23:12 yobiSource

Vicky, Please review this pull request (when you have a chance) and make sure that it works as you intended the code to work. We might need more test cases added to it. Thanks.

woodbri avatar Dec 04 '14 00:12 woodbri

Small update on pull #282 There were problems when paths intersect at more than one point. A test with 297023 lines of OSM data revealed no problems.

yobiSource avatar Dec 04 '14 18:12 yobiSource

+1 to issue.

I've applied the #282 manually in my system, but it doesn't help -- original linestrings still are splitted the very strange way.

unibasil avatar Jan 26 '15 02:01 unibasil

Sorry, @yobiSource, I didn't apply fix correctly, the #282 actually works good.

unibasil avatar Jul 02 '15 03:07 unibasil

Main discussion in #419

cvvergara avatar Nov 08 '15 21:11 cvvergara

This bug is still active, I just reproduced it in both PGR 2.4.1 and 2.50 (using Postgres 9.6.5 and PostGIS 2.3.2)

fitnr avatar Sep 17 '17 14:09 fitnr

@fitnr Yes, its still active, I haven't got time to rewrite pgr_nodeNetwork. This function has too many bugs that needs a full rewrite.

cvvergara avatar Sep 17 '17 17:09 cvvergara

@cvvergara Can I suggest adding a "known bugs" section to the readme and docs?

fitnr avatar Sep 18 '17 15:09 fitnr

Well, its in the list of issues, so they are known.

But a Readme like this one can be done: https://github.com/pgRouting/pgrouting/tree/master/doc/trsp Note that, that readme is generated from executing the actual queries: https://github.com/pgRouting/pgrouting/blob/master/src/trsp/test/trsp_notes_v2.5.0.test.sql So, its a script that demonstrates the bugs.

If you make a PR that works like that and pinpoints the bugs, it would be cool.

cvvergara avatar Sep 18 '17 16:09 cvvergara

Not working on pgr_nodeNetwork for version 3.0

cvvergara avatar Jul 19 '19 18:07 cvvergara