Skip to contents

Stores all bands of a raster to a specified schema in a PostGIS database. All bands are written in the same table in the database.

Usage

store_raster(raster, conn, schema = "public", table_name = NULL)

Arguments

raster

A character string specifying the file path to the GeoTIFF raster file to be stored.

conn

A database connection object to a PostGIS database (e.g., from `RPostgres::dbConnect`).

schema

A string specifying the schema in the PostGIS database where the raster layers will be stored. Default is `"public"`.

table_name

A string, table name. If it is `NULL`, which is the default value, the layer name is derived from the filename.

Value

Invisibly returns a character vector of the names of the tables written to PostGIS.

Details

Transforms the table name according to the Snake Case convention.

See also

Other write to PostGIS: store_bands(), store_layers()

Examples

if (FALSE) { # \dontrun{
source_tif <- system.file("extdata", "mdt.tif", package = "clc")

conn <- DBI::dbConnect(
  RPostgres::Postgres(),
  dbname = "mydb",
  host = "localhost",
  user = "user",
  password = "password"
)

tables <- store_raster(source_tif, conn, table_name = "mdt")

DBI::dbDisconnect(conn)
} # }