Opened 14 years ago

Closed 12 years ago

#1045 closed defect (fixed)

strange behaviour in v.net.path

Reported by: manuele Owned by: grass-dev@…
Priority: normal Milestone: 6.4.1
Component: Vector Version: unspecified
Keywords: network analysis, v.net.path Cc:
CPU: x86-32 Platform: Linux

Description

Dear developers, I found that giving a complete list of origins and destinations in a file I obtain a different result respect giving a single couple from the standard output. For example with the command:

echo "26 4 9" | v.net.path am_net afcol=arc_cost out=myPathMap

I obtain this result:

"cat","id","fcat","tcat","sp","cost","fdist","tdist"
"1", "26","4", "9", "0", "3.0", "0.0", "0.0"

otherwise using the same network map with the different command:

cat am_od_pair.txt | v.net.path am_net afcol=arc_cost out=myPathMap

for the same origin destination couple I obtain:
"cat","id","fcat","tcat","sp","cost", "fdist","tdist"
"26", "26","4", "9", "1", "1.79769313486232e+19","0", "0"

where it even seams that the node 9 is not reachable.

Attachments (2)

am_net.tar.bz2 (2.2 KB ) - added by manuele 14 years ago.
maps needed to reproduce the bug
am_od_pairs.txt (243 bytes ) - added by manuele 14 years ago.
origin-destination list

Download all attachments as: .zip

Change History (7)

by manuele, 14 years ago

Attachment: am_net.tar.bz2 added

maps needed to reproduce the bug

by manuele, 14 years ago

Attachment: am_od_pairs.txt added

origin-destination list

comment:1 by mlennert, 14 years ago

I can't reproduce this with the North Carolina demo data set:

v.net streets_wake points=firestations operation=connect thresh=200 out=streets_firestations
echo "1 15 64" | v.net.path streets_firestations afcol=FT_COST out=myPath
echo "1 15 64" > mypaths.txt
cat mypaths.txt | v.net.path streets_firestations afcol=FT_COST out=myPath2

v.db.select myPath
cat|id|fcat|tcat|sp|cost|fdist|tdist
1|1|15|64|0|21.379|0|0

v.db.select myPath2
cat|id|fcat|tcat|sp|cost|fdist|tdist
1|1|15|64|0|21.379|0|0

Your data is not usable as you don't define the projection system it is in, nor is the attribute table containing the arc_cost column attached. Best would be to either reproduce the bug with the demo dataset, or provide your example data as a complete location, including the sqlite database, or with a dbf attribute backend.

Moritz

comment:2 by huhabla, 14 years ago

I can reproduce this behavior, here is a simple patch:

grass64_release/vector/v.net.path> svn diff
Index: path.c
===================================================================
--- path.c      (Revision 43825)
+++ path.c      (Arbeitskopie)
@@ -258,6 +258,7 @@

            if (ret == 0) {
                sp = SP_UNREACHABLE;
+               cost = 0;
                unreachable++;
                G_warning(_("Point %f,%f is not reachable from "
                            "point %f,%f"), tx, ty, fx, fy);


comment:3 by hamish, 14 years ago

Keywords: v.net.path added
Milestone: 6.4.06.4.1

in reply to:  2 ; comment:4 by mmetz, 14 years ago

Replying to huhabla:

I can reproduce this behavior, here is a simple patch:

I can reproduce it too with 6.4, it's fixed in 6.5 and 7 along with BUG1 and BUG2.

The patch below only sets costs to zero, node 9 is only reachable in 6.5 and 7.

> grass64_release/vector/v.net.path> svn diff
> Index: path.c
> ===================================================================
> --- path.c      (Revision 43825)
> +++ path.c      (Arbeitskopie)
> @@ -258,6 +258,7 @@
> 
>             if (ret == 0) {
>                 sp = SP_UNREACHABLE;
> +               cost = 0;
>                 unreachable++;
>                 G_warning(_("Point %f,%f is not reachable from "
>                             "point %f,%f"), tx, ty, fx, fy);
> 
> 

in reply to:  4 comment:5 by mmetz, 12 years ago

Resolution: fixed
Status: newclosed

Replying to mmetz:

Replying to huhabla:

I can reproduce this behavior, here is a simple patch:

I can reproduce it too with 6.4, it's fixed in 6.5 and 7 along with BUG1 and BUG2.

Fixed 2 years ago in r44066. Closing ticket.

Note: See TracTickets for help on using tickets.