as_sf: Convert an object to a simple feature or bounding box object

View source: R/as_sf.R

as_sfR Documentation

Convert an object to a simple feature or bounding box object

Description

Both functions will pass a NULL value without returning an error. If a POINT or MULTIPOINT object is passed to as_bbox a 0.00000001 meter buffer is applied.

Usage

as_sf(x, crs = NULL, sf_col = "geometry", ...)

as_bbox(x, crs = NULL, ...)

as_sfc(x, crs = NULL, ...)

as_sf_list(x, nm = "data", col = NULL, crs = NULL, clean_names = TRUE)

as_sf_class(x, class = NULL, crs = NULL, null.ok = TRUE, ...)

Arguments

x

A sf, bbox, sfc, raster, sp, or data frame object that can be converted into a simple feature or bounding box object. as_bbox() can also convert a vector with xmin, ymin, xmax, and ymax values. as_sf_list() only supports sf objects or a data frames with a sf list column named "data" (typically created by using dplyr::group_nest() on an sf object.

crs

coordinate reference system

sf_col

A column name to use for the geometry column created by as_sf; defaults to "geometry".

...

Additional parameters passed to as_sf, as_sfc, as_bbox, or as_sf_list

nm

For as_sf_list, name(s) for sf list; defaults to "data". If col is provided, the values of the grouping column are used as names.

col

For as_sf_list, the name of the column used to group data if x is a sf object or used to group and nest data before passing to x.

clean_names

If TRUE, clean names provided to nm or created based on value of col using janitor::clean_names. If FALSE, use names as provided.

class

A class to convert data to; defaults to NULL (which returns "sf")

data

Data that can be converted to sf, sfc, bbox or a sf list object.


elipousson/overedge documentation built on Aug. 13, 2022, 7:41 p.m.