ST_Raster.getValue
Definition
The ST_Raster.getValue function returns the value of a single pixel given that pixel's location within the ST_Raster object. The location can be specified either in pixel coordinates or by geographic coordinates. The function returns an error whenever the specified location is beyond the raster pixel dimension or geographic extent. ST_Raster.getValue returns NULL if the pixel value at the specified location is NoData.
Syntax
Oracle
getValue (band INTEGER, level INTEGER, x INTEGER, y INTEGER) getValue (band INTEGER, level INTEGER, point SE_COORD)
PostgreSQL
getValue (raster IN ST_RASTER, band INT, level INT, x INT, y INT) getValue (raster IN ST_RASTER, band INT, level INT, point SE_COORD)
SQL Server
getValue (band IN NUMBER, level IN NUMBER, x IN NUMBER, y IN NUMBER) getValueByLoc (band IN NUMBER, level IN NUMBER, x IN DOUBLE, y IN DOUBLE)
Returns
Oracle
Number
PostgreSQL
Float8
SQL Server
Double
Parameters
Parameter | Description |
---|---|
band | 像素的波段数(从 1 开始) |
level | 像素的金字塔等级 |
x | x 像素坐标 |
y | y 像素坐标 |
point | 像素的地理坐标 |
raster | The ST_Raster object containing the pixel value |
Examples
The first example returns pixel values for band 1, 2, and 3 for the base pyramid level at pixel location (0,0).
The second example returns pixel values for the base pyramid level for bands 1, 2, and 3 at a geographic location (100.5, 20.5).
Oracle
-
SELECT t.image.getValue(1,0,0,0) r, t.image.getValue(2,0,0,0) g, t.image.getValue(3,0,0,0) b FROM VEG t WHERE image.raster_id = 1; R G B ---------- ---------- ---------- 83 49 173
-
SELECT image.getValue(1,0,se_coord(100.5,20.5)) r, image.getValue(2,0,se_coord(100.5,20.5)) g, image.getValue(3,0,se_coord(100.5,20.5)) b FROM VEG WHERE image.raster_id = 1; R G B ---------- ---------- ---------- 83 49 173
PostgreSQL
-
SELECT getValue(image,1,0,0,0) r, getValue(image,2,0,0,0) g, getValue(image,3,0,0,0) b FROM veg WHERE raster_id(image) = 1; R G B ---------- ---------- ---------- 83 49 173
-
SELECT getValue(image,1,0,se_coord(100.5,20.5)) r, getValue(image,2,0,se_coord(100.5,20.5)) g, getValue(image,3,0,se_coord(100.5,20.5)) b FROM veg WHERE raster_id(image) = 1; R G B ---------- ---------- ---------- 83 49 173
SQL Server
-
SELECT image.getValue(1,0,0,0) r, image.getValue(2,0,0,0) g, image.getValue(3,0,0,0) b FROM veg WHERE image.raster_id = 1; R G B ---------- ---------- ---------- 83 49 173
-
SELECT getValueByLoc(image,1,0,100.5,20.5) as r, getValueByLoc(image,2,0,100.5,20.5) as g, getValueByLoc(image,3,0,100.5,20.5) as b FROM veg WHERE image.raster_id = 1; R G B ---------- ---------- ---------- 83 49 173