This topic describes the ST_PointValues function. The ST_PointValues function returns pixel values for all bands at a specific location.
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, text options default '{}', out integer band, out float8 value);Parameters
Parameter | Description |
raster_obj | The raster object. |
column_sn | The column index of the pixel, starting from the upper-left corner. |
row_sn | The row index of the pixel, starting from the upper-left corner. |
x | The longitude of the pixel. |
y | The latitude of the pixel. |
exclude_nodata | Specifies whether to exclude NoData values. If you set this parameter to true, pixels with NoData values are not returned. |
band | The band number of the pixel. |
value | The pixel value. |
options | The pixel resampling method. Specify the parameter in the JSON string format.
|
Return values
Return value | Description |
band | The band number. |
value | The pixel value. |
Description
This function returns the pixel values of all bands based on the column and row numbers or the longitude and latitude coordinates.
If you configure the resample parameter, the four neighboring pixel values are involved in the calculation.

Examples
SELECT * FROM (SELECT (st_pointValues(rast, 125.84382034243441 , 47.67709555783107, false)).* FROM t_pixel WHERE id = 3) a ORDER BY band;Sample result:
band | value ------+------- 0 | 66 1 | 87 2 | 28SELECT * FROM (SELECT (st_pointValues(rast, 125 , 47)).* FROM t_pixel WHERE id = 3) a ORDER BY band;Sample result:
band | value ------+------- 0 | 39 1 | 66 2 | 11Specify the idw resampling method.
SELECT * FROM (SELECT (st_pointValues(rast, 125.84382034243441 , 47.67709555783107, false, '{"resample" : "idw"}')).* FROM t_pixel WHERE id = 3) a ORDER BY band;Sample result:
band | value ------+-------------------- 0 | 60.81401293159196 1 | 85.23822259113626 2 | 26.300926205142165