Learn R Programming

potential (version 0.3.0)

create_grid: Create a Regularly Spaced Points Grid

Description

This function creates a regular grid of points from the extent of a given spatial object and a given resolution.

Usage

create_grid(x, res)

Value

The output of the function is an sf object of regularly spaced points with the extent of x.

Arguments

x

an sf or sfc object, the spatial extent of this object is used to create the regular grid.

res

resolution of the grid (in map units).

Examples

Run this code
library(sf)
g <- create_grid(x = n3_poly, res = 200000)
plot(st_geometry(g))
plot(st_geometry(n3_poly), border = "red", add = TRUE)

Run the code above in your browser using DataLab