All Products
Search
Document Center

ApsaraDB RDS:ST_PixelAsPoints

Last Updated:Mar 28, 2026

Converts pixels at a specified position of a raster into geometric objects, each represented by a point at the reference position within the geometric object.

Syntax

setof record ST_PixelAsPoints(raster raster_obj,
    integer band default 0,
    integer pyramid default 0,
    boolean exclude_nodata_value default true,
    cstring ref_point default 'UPPERLEFT',
    out integer rowsn,
    out integer columnsn,
    out integer bandsn,
    out double value,
    out geometry geom);

Parameters

ParameterTypeDefaultDescription
raster_objrasterThe raster to query.
bandinteger0The band ID to query. Valid band IDs start from 0.
pyramidinteger0The pyramid level ID to query.
exclude_nodata_valuebooleantrueSpecifies whether to exclude NoData pixels.
ref_pointcstring'UPPERLEFT'The reference position of the point within the geometric object. Valid values: UPPERLEFT (upper-left corner) and CENTER (center).
rowsnout integerThe row number of the pixel.
columnsnout integerThe column number of the pixel.
bandsnout integerThe band ID of the pixel.
valueout doubleThe pixel value.
geomout geometryThe spatial extent of the pixel.

Description

ST_PixelAsPoints converts pixels at a specified position of a raster into geometric objects. Each geometric object is represented by a single point, positioned according to the ref_point parameter—either the upper-left corner (UPPERLEFT) or the center (CENTER) of the pixel geometry.

Example

The following example retrieves all pixels in band 1 from the raster with id = 10, then filters for pixels with a value greater than 38.0, returning each pixel's row, column, band, value, and geometry in Extended WKT format.

WITH tmp AS (
    SELECT (ST_PixelAsPoints(rast, 1)).*
    FROM rast_table
    WHERE id = 10
)
SELECT rowsn, columnsn, bandsn, value, ST_AsEWKT(geom)
FROM tmp
WHERE value > 38.0;

Output:

 rowsn | columnsn | bandsn | value |         st_asewkt
-------+----------+--------+-------+---------------------------
   100 |      100 |      0 |    43 | SRID=4326;POINT(-90 0)