Get a geographic layer associated with a level. We can select the geometry and, using boolean parameters, which attributes are included in the layer's table: only the attributes that make up the key and, if applied to a geodimension, inherited attributes to which the prefix of the level where they are defined can be added.
Usage
get_level_layer(gd, level_name, geometry, only_key, inherited, add_prefix)
# S3 method for geodimension
get_level_layer(
gd,
level_name = NULL,
geometry = NULL,
only_key = FALSE,
inherited = FALSE,
add_prefix = TRUE
)
# S3 method for geolevel
get_level_layer(
gd,
level_name = NULL,
geometry = NULL,
only_key = FALSE,
inherited = FALSE,
add_prefix = TRUE
)
Arguments
- gd
A
geolevel
orgeodimension
object.- level_name
A string.
- geometry
A string.
- only_key
A boolean.
- inherited
A boolean.
- add_prefix
A boolean.
See also
Other information gathering functions:
get_higher_level_names()
,
get_level_data_geo()
,
get_level_data()
,
get_level_geometries()
,
get_level_names()
Examples
layer_us_state <- get_level_layer(gd_us, "state")
state <-
geolevel(name = "state",
layer = layer_us_state,
key = "statefp")
state_ll <- state |>
get_level_layer("polygon")
county_ll <- gd_us |>
get_level_layer(level_name = "county",
geometry = "polygon",
inherited = TRUE)