This function is used to convert a specified pixel of a raster into a geometric object that is represented by a specified point in the geometric object.

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

Parameter Description
raster_obj The raster that you want to query.
row The number of the row in which the pixel resides. Valid row numbers start from 0, which indicates the pixel in the upper-left corner of the raster.
column The number of the column in which the pixel resides. Valid column numbers start from 0, which indicates the pixel in the upper-left corner of the raster.
pyramid The pyramid level in which the pixel resides.
ref_point The reference position of the point in the geometric object. Valid values:
  • UPPERLEFT: specifies the point that resides in the upper-left corner of the geometric object.
  • CENTER: specifies the point that resides in the center of the geometric object.

Description

This function converts a specified pixel of a raster into a geometric object that is represented by a specified point in the geometric object. The reference position of the point is specified by the ref_point parameter.

Examples

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

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