Skip to contents

Constructs a 2D grid of a given number of rows and columns over an sf object.

Usage

make_grid(sf_file, n_row, n_col)

Arguments

sf_file

sf object to pass grid over.

n_row

number of rows in grid.

n_col

number of columns in grid.

Value

An sf object with variables identifying col and row IDs (bottom left origin), geographic centroid of grid square.

Author

Roger Beecham

Examples


library(ggplot2)
grid <- make_grid(london_boroughs, 8, 8)
grid |> ggplot() + geom_sf()