[GRASS-dev] shortest path routing: blocking a direction?

Markus Neteler neteler at osgeo.org
Sat Feb 21 12:44:59 EST 2009


Hi,

I try to understand how to block a street in a certain direction
for shortest path routing (in v.net.alloc just set cost attribute
to -1 and the direction is blocked, apparently not the case for
v.net.path|d.path).

Attached a small map with a roundabout and a screenshot.
The idea is that you cannot go clockwise in the roundabout
(continental European directions).
Still GRASS suggests this...

I did (small sample data set attached):

# import in any metric location, doesn't matter (Spearfish, NC, ...)
v.in.ogr shortest.shp out=roundabout -o
g.region vect=roundabout

# snap broken connections
v.clean roundabout out=roundabout2 tool=snap thresh=10

d.mon x0
d.vect roundabout disp=shape,dir,topo

# look at attributes
v.info -c roundabout
v.db.select roundabout
...

# add two columns to handle directions separately
v.db.addcol roundabout col="forward integer, backward integer"

# initialize directions:
v.db.update roundabout col=backward value=1
v.db.update roundabout col=forward value=1

# reset roundabout to one way (set high costs?? or -1?):
v.db.update roundabout col=backward value=-1 where="cat=4 OR cat=5 OR
cat=6 OR cat=8"

v.db.select roundabout col=cat,desvia,backward,forward

# navigate
d.path roundabout afcol=forward abcol=backward

# If you now start in the south bound street and route clockwise
# in the roundabout, GRASS happily permits this :(

Any suggestions? Anything bad in Vect_net_shortest_path_coor() of
lib/vector/Vlib/net.c ?

thanks
Markus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shortest.zip
Type: application/zip
Size: 1255 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20090221/949cd348/shortest.zip
-------------- next part --------------
A non-text attachment was scrubbed...
Name: roundabout_path.png
Type: image/png
Size: 3079 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20090221/949cd348/roundabout_path.png


More information about the grass-dev mailing list