Create an object of class `clc`.
Arguments
- source
The source of the vector layer. This can be: - A string representing the path to a GeoPackage file. - A `DBI` database connection object to a PostGIS database, created using [RPostgres::dbConnect()].
- layer_name
The name of the layer in the source to be used.
- field
(Optional) A string, the layer field that contains CLC codes. If NULL, the function will attempt to locate the column containing the CLC codes.
Details
This function creates an object of class `clc` from a vector layer in either a GeoPackage or a PostGIS database.
The layer must have a style defined in the source.
See also
Other CLC class functions:
as_raster()
,
copy_to()
,
cut_to_extent()
,
get_colors.clc()
,
get_levels.clc()
,
get_raster()
,
plot_clc()
,
prepare_plot()
,
save_to()
Examples
# ex1
source_gpkg <- system.file("extdata", "clc.gpkg", package = "clc")
clo <- clc(source = source_gpkg, layer_name = "clc")
if (FALSE) { # \dontrun{
# ex2
conn <- RPostgres::dbConnect(
RPostgres::Postgres(),
dbname = 'exampledb',
host = 'localhost',
port = '5432',
user = 'user',
password = 'password'
)
clo <- clc(source = conn, layer_name = "clc")
} # }