Learn R Programming

SpatialPosition (version 1.2.0)

CreateGrid: Create a Regularly Spaced SpatialPointsDataFrame

Description

This function creates a regular grid of SpatialPointsDataFrame from the extent of a given sp object and a given resolution.

Usage

CreateGrid(w, resolution)

Arguments

w

sp object; the spatial extent of this object is used to create the regular SpatialPointsDataFrame.

resolution

numeric; resolution of the grid (in map units). If resolution is not set, the grid will contain around 7500 points. (optional)

Value

The output of the function is a SpatialPointsDataFrame of regularly spaced points with the same extent as w.

See Also

CreateDistMatrix

Examples

Run this code
# NOT RUN {
# Create a SpatialPointsDataFrame grid of spatMask extent and 200 meters 
# resolution
data(spatData)
mygrid <- CreateGrid(w = spatMask, resolution = 200)
plot(mygrid, cex = 0.1, pch = ".")
plot(spatMask, border="red", lwd = 2, add = TRUE)
# }

Run the code above in your browser using DataLab