View source: R/st_layers_as_df.R
st_layers_as_df | R Documentation |
data.frame
Return properties of layers in a datasource as data.frame
st_layers_as_df(x, ..., drop_driver = TRUE, warn = TRUE)
x |
any input that works for |
... |
arguments of the function |
drop_driver |
logical; |
warn |
logical; |
if no layer is available NULL
, else a data.frame
resembling the print
ed return of st_layers
with
columns
name of the layer
for each layer a string listing its geometry type(s)
number of features (if reported; see argument
do_count
of st_layers
)
number of fields
short name of each layer's crs
name of driver, if argument drop_driver
has
been set to FALSE
library(sf)
dsn <- system.file("shape", package = "sf")
st_layers_as_df(x = dsn, drop_driver = FALSE)
# properties of layers of multiple datasources in one data.frame
some_dsn <- list.files(system.file("gpkg", package = "sf"), full.names = TRUE)
multiple_dsn <- c(dsn, some_dsn)
df <-
as.list(multiple_dsn) %>%
setNames(multiple_dsn) %>%
lapply(st_layers_as_df, drop_driver = FALSE) %>%
data.table::rbindlist(use.names = FALSE, idcol = "dsn")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.