rpostgis (version 1.4.3)

pgGetRast: Load raster from PostGIS database.

Description

Retrieve rasters from a PostGIS table.

Usage

pgGetRast(
  conn,
  name,
  rast = "rast",
  bands = 1,
  boundary = NULL,
  clauses = NULL
)

Value

RasterLayer

Arguments

conn

A connection object to a PostgreSQL database

name

A character string specifying a PostgreSQL schema and table/view name holding the geometry (e.g., name = c("schema","table"))

rast

Name of the column in name holding the raster object

bands

Index number(s) for the band(s) to retrieve (defaults to 1). The special case (bands = TRUE) returns all bands in the raster.

boundary

sp object or numeric. A Spatial* object, whose bounding box will be used to select the part of the raster to import. Alternatively, four numbers (e.g. c([top], [bottom], [right], [left])) indicating the projection-specific limits with which to clip the raster. boundary = NULL (default) will return the full raster.

clauses

character, optional SQL to append to modify select query from table. Must begin with 'WHERE'.

Author

David Bucklin david.bucklin@gmail.com

Details

Default is to return a raster-class object RasterLayer for one-band, RasterBrick for multiple bands. sp-class rasters (SpatialGrid*s or SpatialPixels*) written using pgWriteRast will attempt to re-import as the same data class.

Examples

Run this code
if (FALSE) {
pgGetRast(conn, c("schema", "tablename"))
pgGetRast(conn, c("schema", "DEM"), boundary = c(55,
    50, 17, 12))
}

Run the code above in your browser using DataLab