ST_BuildHistogram

更新时间:
复制 MD 格式

Computes the histogram of the band set of a raster object and returns the updated raster with histogram data.

Syntax

raster ST_BuildHistogram(raster raster_obj)

Return type: raster — the input raster with histogram data computed for its band set.

Parameters

ParameterDescription
raster_objThe raster object whose band set to compute a histogram for.

Example

The following example retrieves a raster from a table, builds its histogram, and writes the updated raster back.

DO $$
DECLARE
    rast raster;
BEGIN
    SELECT raster_obj INTO rast FROM raster_table WHERE id = 1;
    rast = st_buildhistogram(rast);
    UPDATE raster_table SET raster_obj = rast WHERE id = 1;
END;
$$ LANGUAGE 'plpgsql';