
Last chance! 50% off unlimited learning
Sale ends in
+proj=longlat
) and in map units (typically meters) when it is projected.
Distances are calculated by summing local distances between cells, which are connected with their neighbours in 8 directions.gridDistance(x, origin, omit=NULL, filename="", ...)
overwrite
Logical. If TRUE
, "filename" will be overwritten if it exists
format
Character. Output file type. See writeRaster
datatype
Character. Output data type. See dataType
progress
Character. "text", "window", or "" (the default, no progress bar)
}distance
for 'as the crow flies' distance. Additional distance measures and options (directions, cost-distance) are available in the 'gdistance' package that is available on R-Forge#world lonlat raster
r <- raster(ncol=10,nrow=10)
r[] <- 1
r[48] <- 2
r[66:68] <- 3
distRaster <- gridDistance(r,origin=2,omit=3)
plot(distRaster)
#UTM small area
projection(r) <- "+proj=utm +zone=15 +ellps=GRS80 +datum=NAD83 +units=m +no_defs"
distRaster <- gridDistance(r,origin=2,omit=3)
plot(distRaster)
Run the code above in your browser using DataLab