This function is used to convert a specified pixel of a raster into a geometric object that is represented by the point in the center of the geometric object.
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 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. |
Description
This function converts a specified pixel of a raster into a geometric object that is represented by the point in the center of the geometric object. You can obtain the same result for a pixel if you set the ref_point parameter of the ST_PixelAsPoint function to CENTER.
Examples
SELECT ST_AsText(ST_PixelAsCentroid(rast, 10, 10))
FROM rast_table
WHERE id = 10;
------------------
POINT(-178.2 88.2)