Learn R Programming

sf (version 0.2-2)

sfc: create simple feature collection object of class sfc from list

Description

create simple feature list column, set class, and add coordinate reference system

Usage

st_sfc(..., crs = NA_integer_, precision = 0)

Arguments

...
one or more simple feature objects
crs
coordinate reference system: integer with the epsg code, or character with proj4string
precision
numeric; see st_as_binary

Details

a simple feature collection object is a list of class c("stc_TYPE", "sfc") which contains objects of identical type. This function creates such an object from a list of simple feature objects (of class sfg), and coerces their type if necessary: collections of XX and MULTIXX are coerced to MULTIXX (with XX: POINT, LINESTRING or POLYGON), other sets are coerced to GEOMETRYCOLLECTION.

in case epsg is given but proj4string is not and packages sp and rgdal can be loaded, the proj4string is expanded using the PROJ.4 epsg database.

Examples

Run this code
pt1 = st_point(c(0,1))
pt2 = st_point(c(1,1))
(sfc = st_sfc(pt1, pt2))
d = data.frame(a = 1:2)

Run the code above in your browser using DataLab