RS_Value¶
Introduction: Returns the value at the given point in the raster. If no band number is specified it defaults to 1.
Note
Since v1.5.1, if the coordinate reference system (CRS) of the input point geometry differs from that of the raster, then point will be transformed to match the CRS of the raster. If the raster or point doesn't have a CRS then it will default to 4326/WGS84.
Format:
RS_Value (raster: Raster, point: Geometry)
RS_Value (raster: Raster, point: Geometry, band: Integer)
RS_Value (raster: Raster, colX: Integer, colY: Integer, band: Integer)
Since: v1.4.0
Spark SQL Examples:
- For Point Geometry:
SELECT RS_Value(raster, ST_Point(-13077301.685, 4002565.802)) FROM raster_table
- For Grid Coordinates:
SELECT RS_Value(raster, 3, 4, 1) FROM raster_table
Output:
5.0