CreateGrid | R Documentation |
This function creates a regular grid of points from the extent of a given spatial object and a given resolution.
CreateGrid(w, resolution, returnclass = "sp")
w |
sp or sf object; the spatial extent of this object is used to create the regular grid. |
resolution |
numeric; resolution of the grid (in map units). If resolution is not set, the grid will contain around 7500 points. (optional) |
returnclass |
"sp" or "sf"; class of the returned object. |
The output of the function is a regularly spaced points grid
with the extent of w
.
CreateDistMatrix
# Create a grid of paris extent and 200 meters
# resolution
library(SpatialPosition)
library(sf)
data(hospital)
mygrid <- CreateGrid(w = paris, resolution = 200, returnclass = "sf")
plot(st_geometry(mygrid), cex = 0.1, pch = ".")
plot(st_geometry(paris), border="red", lwd = 2, add = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.