st_as_sf {csquares}R Documentation

Create a simple features object from c-squares

Description

Converts a character string of c-squares in a spatially explicit simple features object (sf. It can also convert data.frames with a column of c-squares codes to an sf object.

Usage

st_as_sf.csquares(x, ..., use_geometry = TRUE)

st_as_sfc.csquares(x, ..., use_geometry = TRUE)

Arguments

x

A vector of character strings. Each element should hold a valid c-square code. x can also be a data.frame with a column of c-square codes. (Note that wildcard characters are not supported)

...

Ignored

use_geometry

If use_geometry is TRUE and x inherits a spatial feature, its geometry will be used to cast the object. This is much faster than its alternative when use_geometry is FALSE. In the latter case, the c-square codes are first translated into explicit spatial information. The latter is more reliable as it does not rely on the assumption that the geometry of x corresponds with the csquares codes in the object. In short: use TRUE for speed, use FALSE for reliability.

Value

In case of st_as_sfc.csquares a list of geometries (sfc, (MULTI)POLYGONS) is returned. In case of st_as_sf.csquares an object of class (sf) is returned.

Author(s)

Pepijn de Vries

Examples

library(sf)
st_as_sfc(as_csquares("7500:110:3|7500:110:1|1500:110:3|1500:110:1"))
st_as_sf(as_csquares("7500:110:3|7500:110:1|1500:110:3|1500:110:1"))

[Package csquares version 0.0.7 Index]