[GRASSLIST:21] Re: Creating axis of a river

Hamish hamish_nospam at yahoo.com
Sun Mar 12 00:00:37 EST 2006


> > > I got a 3d vector file made of 2 lines which describes the
> > > boundairs of a river... I need to create the mid-line between
> > > them.. (the axis of the river)..
> > > Any ideas?
> >
> > There is probably a better way, but one method I have recently used:
> >
> > g.region res=10 -a
> >
> > v.category in=Coastline out=Coastline_bdy_cat op=add type=boundary
> > step=0
> 
> GRASS 6.1.cvs (tevere):~ > v.category in=fiume_tevere
> out=fiume_tevere_bdy_cat op=add type=boundary step=0
> Building topology ...
> 79 primitives registered
> Building areas:  100%
> 0 areas built
> 0 isles built
> Attaching islands:
> Attaching centroids:  100%
> Topology was built.
> Number of nodes     :   99
> Number of primitives:   79
> Number of points    :   0
> Number of lines     :   79
> Number of boundaries:   0
> Number of centroids :   0
> Number of areas     :   0
> Number of isles     :   0

ok, you are starting already with lines, not area boundaries, so no need
to turn boundaries into lines with v.type. (v.extract only works on
features with a category, thus v.category.) You can go to the v.to.rast
step directly, make a "one" map for the cost,

r.mapcalc cost_map=1

then do r.cost -k, 'r.param.scale param=slope size=7', threshold at
about 30 degrees with r.mapcalc, r.thin.

bonus: river width at any point is possible by using r.mapcalc to make
r.thin map have cost's values * 2, then r.grow out to the edges.


BUT, looking at your data, the river is 30m wide so a 10m raster
resolution would make the output too coarse so this method is pretty
bad. Maybe ok if you used 1m resolution on a small section but
not practicable for the whole area.

You need a vector solution for figuring out river width, someone else
will have to help you with that.


Hamish




More information about the grass-user mailing list