[GRASS-dev] Streams extraction from streams map

Markus Neteler neteler at itc.it
Thu May 3 10:43:13 EDT 2007


On Wed, May 02, 2007 at 11:35:10PM +1200, Hamish wrote:
> Markus Neteler wrote:
> > > I have a network of streams (say, Spearfish or better the new
> > > NC data set at http://mpa.itc.it/grasstutor/data_menu3rd.phtml )
> > > and want to extract a single stream system. Names are lacking,
> > > is there any trick to extract topologically connected lines
> > > into a new map?
> > 
> > Probably we need some equivalent to the "sides" operator in
> > v.to.db (which tells you the cats of the left and right polygon).
> > Some magic which finds the lines which are connected and writes
> > out some related attribute(s).
> 
> how about v.net.iso? disconnected networks will have infinite cost.

Wow - that works!

Spearfish example:

d.vect streams disp=shape,dir
d.where
g.copy vect=streams,mystreams

echo "602042|4927928" | v.in.ascii out=outlet --o
v.distance -p from=outlet to=mystreams out=connect upload=dist column=dist --o

v.patch in=mystreams,connect,outlet out=streams_n --o
v.clean streams_n out=streams_net tool=snap,break thresh=5,0 --o

g.region vect=streams_net
d.erase
d.vect streams_net
d.vect streams_net type=point col=red icon=basic/triangle

v.net.iso streams_net out=myriver ccats=1 costs=99999999 nlayer=1 --o

v.category myriver option=report
# The network is of 2 categories
# show selected river network
d.vect myriver col=blue  cats=1
d.vect myriver col=green cats=2

# now v.extract  etc ...

Note that some upper parts of the river network are not found due to
unconnected lines.

Thanks for the hint,
Markus




More information about the grass-dev mailing list