All Products
Search
Document Center

PolarDB:ST_PixelAsPoint

Last Updated:Mar 28, 2026

Converts a pixel in a raster to a geometry point, with the point positioned at a specified reference location within the pixel.

Syntax

geometry ST_PixelAsPoint(raster raster_obj,
    integer row default 0,
    integer column default 0,
    integer pyramid default 0,
    cstring ref_point default 'UPPERLEFT');

Parameters

ParameterDescription
raster_objThe raster to query.
rowThe row number of the pixel. Row numbers start from 0, which corresponds to the top row of the raster. Default value: 0.
columnThe column number of the pixel. Column numbers start from 0, which corresponds to the leftmost column of the raster. Default value: 0.
pyramidThe pyramid level of the pixel. Default value: 0.
ref_pointThe reference position within the pixel used to generate the output point. Default value: UPPERLEFT. Valid values:
  • UPPERLEFT: the upper-left corner of the pixel.
  • CENTER: the center of the pixel.

Description

ST_PixelAsPoint returns a geometry point representing a single pixel in a raster. The output point coordinates correspond to the position specified by ref_point—either the upper-left corner or the center of the pixel.

Row and column numbers are zero-indexed. The pixel at row 0, column 0 is in the upper-left corner of the raster.

Examples

Get the upper-left corner point of the pixel at row 10, column 10:

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

Output:

POINT(-178.2 88.2)