new_csquares {csquares}R Documentation

Create a c-squares raster from a bounding box

Description

Creates a spatial raster (stars) with c-square codes for a specified bounding box, using a specified resolution. The raster will be conform c-squares specifications.

Usage

new_csquares(x, resolution = 1, crs = 4326)

Arguments

x

An object of class bbox or an object that can be coerced to a bbox. It defines the bounding box for the c-squares grid created by this function.

resolution

Resolution (in WGS84 degrees) to be used for creating c-squares codes. As per c-square specifications, the resolution should be 10 or less, yet greater than 0. It should be a tenfold of 1 or 5. Valid resolutions are therefore: 10, 5, 1, 0.5, 0.1, etc.

crs

The projection to be used for the created grid. By default it is WGS84 (EPSG:4326).

Value

Returns a stars and csquares object based on the provided bounding box and resolution.

Author(s)

Pepijn de Vries

Examples

library(sf)
nc <- st_read(system.file("shape/nc.shp", package = "sf"))
new_csquares(nc)

[Package csquares version 0.0.7 Index]