Skip to content

RS_Values

Returns the pixel values under each point of a MultiPoint geometry as a list of doubles, one element per point. An element is null where the point falls outside the raster or the pixel holds the band’s nodata value.

Usage

list RS_Values(rast: raster, points: geometry)
list RS_Values(rast: raster, points: geometry, band: int)

Arguments

  • rast (raster): Input raster
  • points (geometry): The pixel that contains each sub-point is sampled (no resampling). Reprojected into the raster CRS when both carry one. A single Point is also accepted and yields a one-element list.
  • band (int): Band index (1-based). When omitted, defaults to band 1, but only for a single-band raster; sampling an unspecified band of a multiband raster is ambiguous and raises an error.

[!WARNING]

Experimental. This function is experimental; its behavior may change without notice.

Description

RS_Values is the plural form of RS_Value: it samples one pixel per point of a MultiPoint and returns the values as a list of doubles, in the same order as the input points. A single Point is accepted as well and produces a one-element list.

The band defaults to 1 when omitted, but only for a single-band raster; on a multiband raster the band is ambiguous and must be given explicitly.

Each list element is NULL when its point falls outside the raster or the sampled pixel equals the band’s nodata value; the whole result is NULL when the raster, geometry, or band is NULL. An empty MultiPoint yields an empty list. Only 2-D rasters are supported.

Examples

SELECT RS_Values(
  RS_Example(),
  ST_GeomFromText('MULTIPOINT (74.58 110.57, 500 500)', 'OGC:CRS84'),
  1
);
┌──────────────────────────────────────────────────────────────────────────────┐
│ rs_values(rs_example(),st_geomfromtext(Utf8("MULTIPOINT (74.58 110.57, 500 5 │
│                      00)"),Utf8("OGC:CRS84")),Int64(1))…                     │
╞══════════════════════════════════════════════════════════════════════════════╡
│ [1.0, ]                                                                      │
└──────────────────────────────────────────────────────────────────────────────┘