All Products
Search
Document Center

PolarDB:ST_Polygonize

Last Updated:Mar 28, 2026

Vectorizes a raster object by grouping pixels with the same value into polygon geometries.

Syntax

setof record ST_Polygonize( raster rast,
                            integer bandnumber,
                            cstring options,
                            out geom geometry,
                            out id integer,
                            out value float8);

Parameters

ParameterRequiredDescription
rastYesThe input raster object.
bandnumberYesThe band number to vectorize. Band numbering starts at 0.
optionsNoThe vectorization configuration, specified as a JSON string. See the options fields below.

options fields

FieldTypeDescriptionDefault
ingoreValuefloatA pixel value to exclude from vectorization, in addition to the nodata value.0

Return value

ST_Polygonize returns a set of records, one per distinct pixel value group. Each record contains the following fields:

FieldTypeDescription
geomgeometryThe polygon geometry representing the region covered by pixels of the same value.
idintegerThe sequential identifier of the record.
valuefloat8The pixel value shared by all pixels in the polygon.

Examples

The following example vectorizes band 1 of the raster stored in rast_table where id = 1, excluding pixels with value 0.

select ST_Polygonize(rast, 1, '{"ingoreValue":0}') from rast_table where id = 1;

Input

image.png

Output

image.png