Transform a spatial object to class sf

gc_sf(input, ...)

# S4 method for geom
gc_sf(input = NULL)

Arguments

input

the object to transform to class sf.

...

other arguments.

Value

If input is a geom and has attributes other than fid and gid, a "Simple feature collection", otherwise a "Geometry set". Several features of the geom are returned as MULTI* feature, when they have gid and optionally other attributes in common, otherwise they are returned as a single simple feature.

See also

Other spatial classes: gc_geom(), gc_raster(), gc_sp(), gc_terra()

Examples

gc_sf(input = gtGeoms$point)
#> Warning: MULTIPOINTS don't support individual attributes per point, ignoring 'fid'.
#> Simple feature collection with 2 features and 0 fields
#> Geometry type: MULTIPOINT
#> Dimension:     XY
#> Bounding box:  xmin: -34.64102 ymin: -40 xmax: 34.64102 ymax: 40
#> CRS:           NA
#>                             geom
#> 1 MULTIPOINT ((0 -40), (34.64...
#> 2 MULTIPOINT ((-34.64102 20),...

gc_sf(input = gtGeoms$line)
#> Simple feature collection with 2 features and 0 fields
#> Geometry type: LINESTRING
#> Dimension:     XY
#> Bounding box:  xmin: -34.64102 ymin: -40 xmax: 34.64102 ymax: 40
#> CRS:           NA
#>                             geom
#> 1 LINESTRING (0 -40, 34.64102...
#> 2 LINESTRING (-34.64102 20, -...

gc_sf(input = gtGeoms$polygon)
#> Simple feature collection with 2 features and 0 fields
#> Geometry type: POLYGON
#> Dimension:     XY
#> Bounding box:  xmin: -34.64102 ymin: -40 xmax: 34.64102 ymax: 40
#> CRS:           NA
#>                             geom
#> 1 POLYGON ((0 -40, 34.64102 -...
#> 2 POLYGON ((-34.64102 20, -34...