This topic describes the ST_PointValues function. This function is used to obtain the pixel values of all bands.
Syntax
setof record ST_PointValues(raster raster_obj,
integer column_sn,
integer row_sn,
boolean exclude_nodata default true,
out integer band,
out float8 value);
setof record ST_PointValues(raster raster_obj,
float8 x,
float8 y,
boolean exclude_nodata default true,
out integer band,
out float8 value);
Parameters
Parameter | Description |
---|---|
raster_obj | The raster object that you want to clip. |
column_sn | The number of the column in which the pixel resides. The pixel value is calculated from the upper-left corner of the raster object. |
row_sn | The number of the row for the pixel. The pixel value is calculated from the upper-left corner of the raster object. |
x | The x coordinate of the pixel. |
y | The y coordinate of the pixel. |
exclude_nodata | Specifies whether to return the NoData value of the raster object.
If you specify this parameter to true and the pixel value is NoData, this function does not return the NoData value of the raster object. |
band | The number of the band in which the pixel resides. |
value | The value of the pixel. |
Description
This function returns the pixel values of all bands based on the number of the column row in which the pixel resides and the x and y coordinates of the pixel.
Examples
select * from
( select (st_pointValues(rast, 125.84382034243441 , 47.67709555783107, false)).*
from t_pixel where id = 3) a
ORDER by band;
band | value
------+-------
0 | 66
1 | 87
2 | 28
select * from
( select (st_pointValues(rast, 125 , 47)).*
from t_pixel where id = 3) a
ORDER by band;
band | value
------+-------
0 | 39
1 | 66
2 | 11