[GRASS-user] Straight-line distance of raster from point

Hamish hamish_b at yahoo.com
Fri Mar 11 23:32:18 EST 2011


Joshua wrote:
> For each cell in a raster I'd like to calculate the
> straight line distance (from it's centre) to a vector point,
> with the output stored as the value of a new raster. I've
> had a look through the manual and the archives, but I can't
> find any obvious way to do this.

just a single vector point?

the easiest way is to work backwards with r.cost, then multiply
by the cell size. but that is not exactly accurate (see help
page).

for something more exact you'd have to use r.mapcalc with
something like  sqrt( (x() - x_coord)^2 + (y() - y_coord)^2 ).


Hamish



      


More information about the grass-user mailing list