Opened 8 years ago

Closed 8 years ago

#1861 closed defect (wontfix)

v.net.distance should exclude path to self

Reported by: mlennert Owned by: grass-dev@…
Priority: normal Milestone: 7.0.0
Component: Vector Version: svn-trunk
Keywords: network distance Cc:
CPU: Unspecified Platform: Unspecified

Description

When using v.net.distance in grass7, giving it all the available nodes as from and to nodes, the result is a series of zero length paths from each node to itself. v.net.distance should skip paths to self and chose the closest node amongst the remaining set of nodes.

To reproduce:

v.net roadsmajor points=schools_wake op=connect thresh=500 out=network --o

should probably be renamed to "threshold" for consistency?

v.net.distance network out=paths from_layer=2 from_cats=1-999 to_layer=2 to_cats=1-999 --o

[from_layer and to_layer should probably be 2 by default]

v.db.select paths

cat|tcat|dist
7|7|0
8|8|0
9|9|0
28|28|0
[...]

Moritz

Change History (3)

comment:1 in reply to:  description ; Changed 8 years ago by mmetz

Replying to mlennert:

When using v.net.distance in grass7, giving it all the available nodes as from and to nodes, the result is a series of zero length paths from each node to itself. v.net.distance should skip paths to self and chose the closest node amongst the remaining set of nodes.

Technically, this is possible and actually not very difficult, but it would require to rewrite v.net.distance from scratch.

Currently, the module starts with all 'to' nodes and calculates the shortest path of all nodes to all 'to' nodes. Then the module iterates through the 'from' nodes and finds for each 'from' node the nearest 'to' node. At this point it is too late to exclude paths to self because that is the only path computed.

Markus M

comment:2 in reply to:  1 ; Changed 8 years ago by mlennert

Replying to mmetz:

Replying to mlennert:

When using v.net.distance in grass7, giving it all the available nodes as from and to nodes, the result is a series of zero length paths from each node to itself. v.net.distance should skip paths to self and chose the closest node amongst the remaining set of nodes.

Technically, this is possible and actually not very difficult, but it would require to rewrite v.net.distance from scratch.

Currently, the module starts with all 'to' nodes and calculates the shortest path of all nodes to all 'to' nodes. Then the module iterates through the 'from' nodes and finds for each 'from' node the nearest 'to' node. At this point it is too late to exclude paths to self because that is the only path computed.

Ok, then I'll just add a hint to the man page indicating that from and to nodes should be different. One can always use v.net.allpairs to get the same info with a bit of postprocess data massaging.

Moritz

comment:3 in reply to:  2 Changed 8 years ago by mlennert

Resolution: wontfix
Status: newclosed

Replying to mlennert:

Replying to mmetz:

Replying to mlennert:

When using v.net.distance in grass7, giving it all the available nodes as from and to nodes, the result is a series of zero length paths from each node to itself. v.net.distance should skip paths to self and chose the closest node amongst the remaining set of nodes.

Technically, this is possible and actually not very difficult, but it would require to rewrite v.net.distance from scratch.

Currently, the module starts with all 'to' nodes and calculates the shortest path of all nodes to all 'to' nodes. Then the module iterates through the 'from' nodes and finds for each 'from' node the nearest 'to' node. At this point it is too late to exclude paths to self because that is the only path computed.

Ok, then I'll just add a hint to the man page indicating that from and to nodes should be different.

Done in all branches.

Moritz

Note: See TracTickets for help on using tickets.