Returns the centroid (point geometry) of the area represented by a raster pixel.
Syntax
geometry ST_PixelAsPoint(raster raster_obj,
integer row default 0,
integer column default 0,
integer pyramid default 0);Parameters
| Parameter | Description |
|---|---|
| raster_obj | The raster to query. |
| row | The row index of the pixel. Indices start at 0, which corresponds to the upper-left corner of the raster. |
| column | The column index of the pixel. Indices start at 0, which corresponds to the upper-left corner of the raster. |
| pyramid | The pyramid level of the pixel. |
Description
ST_PixelAsCentroid returns a point geometry at the center of the specified pixel. 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;
------------------
POINT(-178.2 88.2)Related functions
| Function | Description |
|---|---|
| ST_PixelAsPoint | Returns a point geometry for the specified pixel at a configurable reference point (upper-left corner, center, or other positions). |