Skip to contents

Create an object of class `clc`.

Usage

clc(source, layer_name, field = NULL)

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.

Value

An object of class `clc`.

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

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")
} # }