This topic describes how to obtain the percentage of bands for imagery.
Syntax
float8 ST_Percentile(raster raster_obj,
integer band,
integer percentage)
Parameters
Parameter | Description |
---|---|
raster_obj | The raster object. |
band | The specified band SNs that start from 0 in a format similar to '0,1-3,6,8' . Double quotation marks ('' ) indicate all bands.
|
percentage | The percentage of the specified bands for the raster object. You can use ST_BuildPercentiles or ST_ComputeStatistics to obtain the percentage. |
Examples
SELECT st_percentile(rast_obj, 0, 10)
FROM raster_table
WHERE id = 1;
--------------------
29.7
You can also use ST_Percentile to implement the ST_Quantile feature.
SELECT st_percentile(rast_obj, 0, 25), st_percentile(rast_obj, 0, 50)
FROM raster_table
WHERE id = 1;