Calculates the percentiles of the specified bands in a raster object.
Syntax
raster ST_BuildPercentiles(raster raster_obj,
cstring sampleOption default '{}')
raster ST_BuildPercentiles(raster raster_obj,
cstring bands,
cstring sampleOption default '{}',
cstring parallelOption default '{}')
Parameters
| Parameter | Description |
|---|
| raster_obj | The raster object to process. |
| bands | The band IDs to include. Use comma-separated values and ranges, for example '0,1-3,6,8'. Band IDs start from 0. To include all bands, set this to ''. |
| sampleOption | A JSON string specifying sampling options. See sampleOption parameters. |
| parallelOption | A JSON string specifying parallel execution options. See parallelOption parameters. |
sampleOption parameters
| Parameter | Type | Default | Description |
|---|
| approx | boolean | false | Specifies whether to use approximate sampling. When set to true, the function uses the sampling method defined by factor, which may produce less precise results. |
| factor | integer | 4 | The sampling factor, expressed as the number of pixels per sampling unit. Any positive integer is valid. This parameter applies only when approx is true. |
| exclusive_nodata | boolean | true | Specifies whether to include NoData values. Valid values: true and false. |
parallelOption parameters
| Parameter | Type | Default | Description |
|---|
| parallel | integer | ganos.parallel.degree | The degree of parallelism. Valid values: 1 to 64. |
Examples
-- Use default settings.
UPDATE raster_table SET raster_obj = ST_BuildPercentiles(raster_obj) WHERE id = 1;
-- Specify bands and disable approximate sampling.
UPDATE raster_table SET raster_obj = ST_BuildPercentiles(raster_obj, '0-2', '{"approx":false}') WHERE id = 1;
-- Disable approximate sampling without specifying bands.
UPDATE raster_table SET raster_obj = ST_BuildPercentiles(raster_obj, '{"approx":false}') WHERE id = 1;
-- Specify bands, enable approximate sampling with a custom factor, and set the degree of parallelism.
UPDATE raster_table SET raster_obj = ST_BuildPercentiles(raster_obj, '0-2', '{"approx":true, "factor":5}', '{"parallel":4}') WHERE id = 1;