All Products
Search
Document Center

ApsaraDB RDS:ST_BuildPercentiles

Last Updated:Mar 28, 2026

Calculates the percentiles of 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

ParameterDescription
raster_objThe raster object.
bandsThe band IDs to process. Example: '0,1-3,6,8'. Band IDs start from 0. To process all bands, set this parameter to ''.
sampleOptionA JSON string of sampling options. See the sampleOption parameters table. Defaults to '{}'.
parallelOptionA JSON string of parallel execution options. See the parallelOption parameters table. Defaults to '{}'.

sampleOption parameters

ParameterTypeDefaultDescription
approxBooleanfalseSpecifies whether to use approximate sampling. If set to true, sampling is applied but the result may be inaccurate.
factorinteger4The 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_nodataBooleantrueSpecifies whether to include NoData values. Valid values: true and false.

parallelOption parameters

ParameterTypeDefaultDescription
parallelintegerganos.parallel.degreeThe degree of parallelism. Valid values: 1 to 64.

Examples

-- Use the default parameter settings.
UPDATE raster_table SET raster_obj = ST_BuildPercentiles(raster_obj) WHERE id = 1;

-- Specify the bands and the sampling method.
UPDATE raster_table SET raster_obj = ST_BuildPercentiles(rast,'0-2','{"approx":false}') WHERE id = 1;

-- Specify the sampling method.
UPDATE raster_table SET raster_obj = ST_BuildPercentiles(rast,'{"approx":false}') WHERE id = 1;

-- Specify the bands, sampling rate, and degree of parallelism.
UPDATE raster_table SET raster_obj = ST_BuildPercentiles(raster_obj,'0-2','{"approx":true, "factor":5}', '{"parallel":4}') WHERE id = 1;