Distance on a grid
gridDistance.RdThe function calculates the distance to cells of a RasterLayer when the path has to go through the centers of neighboring raster cells (currently only implemented as a 'queen' case in which cells have 8 neighbors).
The distance is in meters if the coordinate reference system (CRS) of the RasterLayer is longitude/latitude (+proj=longlat) and in the units of the CRS (typically meters) in other cases.
Distances are computed by summing local distances between cells, which are connected with their neighbours in 8 directions.
Arguments
- x
RasterLayer
- origin
value(s) of the cells from which the distance is calculated
- omit
value(s) of the cells which cannot be traversed (optional)
- filename
character. output filename (optional)
- ...
additional arguments as for
writeRaster
See also
See distance for 'as the crow flies' distance. Additional distance measures and options (directions, cost-distance) are available in the 'gdistance' package.

