[GRASSLIST:7981] Re: Calculating "costdistance" using a DEM (aka 3-d distance)

Ellen De Beuckeleer ellen.debeuckeleer at incgeo.be
Fri Aug 19 02:43:22 EDT 2005

To calculate the shortest distance between two points first create a 
cost surface. this can be done via the user interface: Raster->Terrain 
Analysis->cost surface, which calls r.cost. You need to give the raster 
map which contains the costs. This can be your DEM, (but you can also 
use the slope (Raster->Terrain Analysis->slope and aspect = 
r.slope.aspect) to create slopes based on your DEM.) You also need to 
give the coordinates of your starting point.

After creating the cost surface call r.drain (Raster->Terrain Analysis-> 
Least cost route or flow). As parameters you have to provide the end 
point of your route. You can choose between 3 flags:   -c   Copy input 
cell values on output,   -a   Accumulate input values along the path,   
-n   Count cell numbers along the path.

I think, this should do it.


Jonathan Greenberg wrote:

>How do I go about calculating the shortest distance between two points given
>a DEM?  I think this is called costdistance in ARC, but is there an
>equivalent for GRASS?  Thanks!
>Jonathan A. Greenberg, PhD
>NRC Research Associate
>NASA Ames Research Center
>MS 242-4
>Moffett Field, CA 94035-1000
>Office: 650-604-5896
>Cell: 415-794-5043
>AIM: jgrn307
>MSN: jgrn307 at hotmail.com

More information about the grass-user mailing list