[GRASS-dev] Re: d.vect changes

Hamish hamish_nospam at yahoo.com
Thu May 3 04:32:00 EDT 2007


> > Markus wrote:
> > > d.vect kills x0
> > ..
> > > strace d.vect myroads_net col=red
HB:
> > don't know, can you reproduce it with a spearfish map?
> > make distclean? ;)
MN: 
> It happens with Spearfish. Just try my new v.net.path
> example in the description.html.

all works fine for me, even when fancy:
  d.vect myroads_net icon=basic/triangle fcol=green size=12
  d.vect myroads_net disp=cat type=point lsize=14


> BTW: the v.clean step therein fails - it does NOT properly
> connect the lines. Sigh.

Is that where this v.net.path error comes from?

Building graph ...
Registering arcs ...
 100%
Flattening the graph ...
Graph was built
dglShortestPath error: Head Node Not Found
WARNING: Point with category [10] is not reachable from point with category
         [9]
WARNING: [1] destinations unreachable (including points outof threshold)
Building topology ...
0 primitives registered      

 * "[1] destinations unreachable" reads weird as "1" is not parenthetical

This is because "connect" lines are missing any cat values. v.clean (and
almost all vector modules) work by cycling through the list of cats. You
have to use v.category to give them a cat before going on. I have forgotten
to do this enough times that now I always remember it.

[...]
v.db.addtable connect  ...

# use cat 0 (no data) for both roads as "off-road" ?
v.category in=connect out=connect_cat cat=0 step=0
# not sure if this is needed later?
# v.db.update won't work for a insert? add a -i flag to it? new module?
echo "INSERT INTO connect_cat (cat, label, forward, backward) VALUES (0, 'no data', 50, 50)" | db.execute

v.db.select connect
v.db.select connect_cat

[...]

then I get a nice mypath vector and no error from v.net.path.


> I have added some examples based on Spearfish:
> v.net.iso/description.html
> v.net.path/description.html
> 
> They need testing and simplification (v.net.path).
> My problem is how to get the nodes (centers) onto the
> network lines. Maybe we should implement threshold such
> as in d.path? If you look at the v.net.path, you see that
> it is rather painful to connect the node to the network.
> Or some fancy v.edit trick to digitize the start/end
> nodes?

v.net.iso: the v.clean step also removes the point patched into roads_n ?


v.net.path:
"Shortest path from two digitized nodes" example
also try:
  d.path -b roads coor="601653.5,4922869.2","593330.8,4924096.6"
and
  d.path -b myroads_net coor="601653.5,4922869.2","593330.8,4924096.6" \
    afcol=forward hcolor=green


[I do get a segfault from d.path if I spell the af column name wrong.]


Hamish




More information about the grass-dev mailing list