Transform a spatial object to class geom
gc_geom(input, ...) # S4 method for Spatial gc_geom(input = NULL, ...) # S4 method for sf gc_geom(input = NULL, group = FALSE, ...) # S4 method for Raster gc_geom(input = NULL, stack = FALSE, group = FALSE, as_hex = FALSE, ...)
input | the object to transform to class |
---|---|
... | additional arguments. |
group | [ |
stack | [ |
as_hex | [ |
an object of class geom
When transforming a simple feature to a geom, all MULTI* features
are organised on a per feature basis, where the attribute table of features
in the geom contains those variables that are valid for each feature, while
the attribute table of groups contains those variables, that are unique
only at the level of groups of features (i.e., at the level of MULTI*
simple features). Those variables that are valid at the level of groups
would be duplicated in the attribute table of features. When a MULTI*
feature is transformed to a geom, the default behaviour is to copy the
simple feature as closely as possible. However, to reduce the object size
(and improve its' organisation), it is possible to assign the attributes of
groups into the attribute table of groups of the geom by setting
group = TRUE
.
When transforming a Raster* (or possibly other gridded classes) with
several layers to a geom, the layers are by default organised into a list
with a layer per list item. However, when several layers contain
fundamentally the same data (i.e., values that are associated to the same
groups), layers could be stacked stack = TRUE
, because they share
the same group attribute table.
gc_sf(input = gtGeoms$polygon) %>% gc_geom() #> geom polygon #> 2 groups | 2 features | 11 points #> crs cartesian #> attributes -- #> tiny map 40 #> ◌ ○ ○ ◌ #> ◌ ○ ○ ◌ #> ◌ ○ ○ ◌ #> -34.64 ◌ ◎ ◎ ◌ 34.64 #> -40 gc_raster(input = gtGeoms$grid$categorical) %>% gc_geom() #> geom grid #> 1 layer | 3360 cells #> crs cartesian #> attributes cover #> resolution 1 1 (x, y) #> extent 0 60 0 56 (xmin, xmax, ymin, ymax)