All Products
Search
Document Center

PolarDB:ST_PixelAsCentroid

Last Updated:Mar 28, 2026

Returns the centroid (point geometry) of the area represented by a raster pixel.

Syntax

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

Parameters

ParameterDescription
raster_objThe raster to query.
rowThe row index of the pixel. Indices start at 0, which corresponds to the upper-left corner of the raster.
columnThe column index of the pixel. Indices start at 0, which corresponds to the upper-left corner of the raster.
pyramidThe pyramid level of the pixel.

Description

ST_PixelAsCentroid returns a point geometry at the center of the specified pixel. This is equivalent to calling ST_PixelAsPoint with ref_point set to CENTER.

Example

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

------------------
POINT(-178.2 88.2)

Related functions

FunctionDescription
ST_PixelAsPointReturns a point geometry for the specified pixel at a configurable reference point (upper-left corner, center, or other positions).