Queries the pixel value at a specified percentile for a raster band.
Syntax
float8 ST_Percentile(raster raster_obj,
integer band,
integer percentage)Parameters
| Parameter | Description |
|---|---|
raster_obj | The raster object. |
band | The band IDs to query. Example: '0,1-3,6,8'. Valid band IDs start from 0. To query all bands, set this parameter to ''. |
percentage | The percentile rank for which to return the pixel value. You can use ST_BuildPercentiles or ST_ComputeStatistics to obtain the percentage. |
Examples
The following example returns the pixel value at the 10th percentile for band 0:
SELECT st_percentile(rast_obj, 0, 10)
FROM raster_table
WHERE id = 1;
--------------------
29.7ST_Percentile can also implement the behavior of ST_Quantile. The following example returns pixel values at the 25th and 50th percentiles for band 0:
SELECT st_percentile(rast_obj, 0, 25), st_percentile(rast_obj, 0, 50)
FROM raster_table
WHERE id = 1;