[GRASS-user] distance along flow line to a particular feature

Massimiliano Cannata massimiliano.cannata at supsi.ch
Mon Aug 7 10:18:03 EDT 2006


Hi,
I've never done it, but i guess you have to consider to use a script 
using r.drain with the -n option....

draft of the script:
- extract x,y coordinates of each cell of your region (basin);
- foreach point run r.drain -n input=your_dem output=your_tmp_output 
coordinate=x,y
- set to null the river cells in your_tmp_output by using r.mapcalc;
- run r.univar map=your_tmp_output and extract the maximum (it is the 
number of cells to reach the river);
- write adding in a file the x,y,max values
- end of foreach
- import x,y,z to vector
- convert vector to raster


maybe too complicate?????

It is just a first idea....

Cheers,
Maxi


//

Godard Vincent wrote:
> Hi Grass users,
> I am quite new to Grass and I come here to get some hints and guidelines about 
> a particular problem I have. 
> I work on a watershed (on which I ran r.watershed, to get flow directions, 
> accumulation...) and inside this watershed I define a linear feature (raster 
> or vector) as the main stream.
> I would like to calculate the distance (along the hydrographic network) of 
> each pixel of this watershed to the main stream. By distance I mean lenght 
> calculated along the flow lines defined by the flow directions. The desired 
> final output is a raster containing that distance to the main stream.
> Has anybody done such a thing with Grass previously?
> Thanks in advance,
> Vincent.
>   


-- 

Dr. Eng. Massimiliano Cannata
Scuola Universitaria Professionale della Svizzera Italiana
Istituto Scienze della Terra
Via Trevano, c.p. 72
CH-6952 Canobbio-Lugano
Tel: +41 (0)58 666 62 14
Fax +41 (0)58 666 62 09 





More information about the grass-user mailing list