All Products
Search
Document Center

ApsaraDB RDS:ST_PixelAsCentroid

Last Updated:Mar 28, 2026

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

Syntax

geometry ST_PixelAsCentroid(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. Valid values start from 0, where 0 is the upper-left corner.
columnThe column index of the pixel. Valid values start from 0, where 0 is the upper-left corner.
pyramidThe pyramid level of the pixel.

Description

ST_PixelAsCentroid converts a specified raster pixel into a point geometry at the center of that pixel's area. 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;

Output:

POINT(-178.2 88.2)

See also

  • ST_PixelAsPoint — Returns a point geometry at a specified reference position within a pixel, such as the upper-left corner or center.