All Products
Search
Document Center

PolarDB:ST_PixelAsPolygon

Last Updated:Mar 28, 2026

Returns the polygon geometry that bounds a specified pixel in a raster.

Syntax

geometry ST_PixelAsPolygon(raster raster_obj,
                            integer row default 0,
                            integer column default 0,
                            integer pyramid default 0);

Parameters

ParameterTypeDefaultDescription
raster_objrasterThe raster to query.
rowinteger0The row index of the pixel. Indexes start at 0, which refers to the top-left pixel of the raster.
columninteger0The column index of the pixel. Indexes start at 0, which refers to the top-left pixel of the raster.
pyramidinteger0The pyramid level of the pixel.

Examples

Retrieve the polygon boundary for the pixel at row 10, column 10:

SELECT ST_AsText(ST_PixelAsPolygon(rast, 10, 10))
FROM rast_table
WHERE id = 10;

Result:

POLYGON((3427927.75 5793244,3427927.8 5793244,3427927.8 5793243.95,...

See also

  • ST_PixelAsPolygons: Returns polygon geometries for all pixels in a raster, or for a specified band.

  • ST_PixelAsPoint: Returns the point geometry of a specified pixel's upper-left corner.

  • ST_AsText: Converts a geometry to Well-Known Text (WKT) format.