clc: 'clc' S3 Class

View source: R/clc.R

clcR Documentation

'clc' S3 Class

Description

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.

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.

Value

An object of class 'clc'.

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

## Not run: 
# ex2
conn <- RPostgres::dbConnect(
  RPostgres::Postgres(),
  dbname = 'exampledb',
  host = 'localhost',
  port = '5432',
  user = 'user',
  password = 'password'
)
clo <- clc(source = conn, layer_name = "clc")

## End(Not run)

clc documentation built on April 4, 2025, 5:17 a.m.