Create simple feature geometry list column, set class, and add coordinate reference system and precision.
For data.frame alternatives see st_sf(). To convert a foreign object to sfc, see st_as_sfc()
Usage
st_sfc(
  ...,
  crs = NA_crs_,
  precision = 0,
  check_ring_dir = FALSE,
  dim,
  recompute_bbox = FALSE,
  oriented = NA
)
# S3 method for class 'sfc'
x[i, j, ..., op = st_intersects]Arguments
- ...
- zero or more simple feature geometries (objects of class - sfg), or a single list of such objects;- NULLvalues will get replaced by empty geometries.
- crs
- coordinate reference system: integer with the EPSG code, or character with proj4string 
- precision
- numeric; see st_as_binary 
- check_ring_dir
- see st_read 
- dim
- character; if this function is called without valid geometries, this argument may carry the right dimension to set empty geometries 
- recompute_bbox
- logical; use - TRUEto force recomputation of the bounding box
- oriented
- logical; if - TRUE, the ring is oriented such that left of the edges is inside the polygon; this is needed for convering polygons larger than half the globe to s2
- x
- object of class - sfc
- i
- record selection. Might also be an - sfc/- sfobject to work with the- opargument
- j
- ignored if - opis specified
- op
- function, geometrical binary predicate function to apply when - iis a- sf/- sfcobject. Additional arguments can be specified using- ..., see examples.
Details
A simple feature geometry list-column is a list of class
c("stc_TYPE", "sfc") which most often contains objects of identical type;
in case of a mix of types or an empty set, TYPE is set to the
superclass GEOMETRY.
if x has a dim attribute (i.e. is an array or matrix) then op cannot be used.
Examples
pt1 = st_point(c(0,1))
pt2 = st_point(c(1,1))
(sfc = st_sfc(pt1, pt2))
#> Geometry set for 2 features 
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: 0 ymin: 1 xmax: 1 ymax: 1
#> CRS:           NA
#> POINT (0 1)
#> POINT (1 1)
sfc[sfc[1], op = st_is_within_distance, dist = 0.5]
#> Geometry set for 1 feature 
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: 0 ymin: 1 xmax: 0 ymax: 1
#> CRS:           NA
#> POINT (0 1)
d = st_sf(data.frame(a=1:2, geom=sfc))
