powered by
The function calculates the distance from a set of points to all cells of a RasterLayer.
The distance unit is in meters if the RasterLayer is not projected (+proj=longlat) and in map units (typically meters) when it is projected.
+proj=longlat
distanceFromPoints(object, xy, filename='', ...)
Raster object
matrix of x and y coordinates, or a SpatialPoints* object.
character. Optional filename for the output RasterLayer
Additional arguments as for writeRaster
writeRaster
RasterLayer object
distance, gridDistance, pointDistance
distance
gridDistance
pointDistance
# NOT RUN { r <- raster(ncol=36,nrow=18) xy = c(0,0) dist <- distanceFromPoints(r, xy) #plot(dist) # }
Run the code above in your browser using DataLab