Returns a point geometry for a specified pixel of a raster. Use ref_point to control whether the point is at the upper-left corner or the center of 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
| Parameter | Description |
|---|---|
raster_obj | The raster to query. |
row | The row index of the pixel, starting from 0 at the upper-left corner. |
column | The column index of the pixel, starting from 0 at the upper-left corner. |
pyramid | The pyramid level of the pixel. |
ref_point | The reference position of the returned point within the pixel. Valid values: UPPERLEFT (default) — upper-left corner of the pixel; CENTER — center of the pixel. |
Example
The following example returns the upper-left corner point of the pixel at row 10, column 10, pyramid level 0.
SELECT ST_AsText(ST_PixelAsPoint(rast, 10, 10))
FROM rast_table
WHERE id = 10;
------------------
POINT(-178.2 88.2)