ST_PixelAsPolygon
Name
ST_PixelAsPolygon — Returns the polygon geometry that bounds the pixel for a particular row and column.
Synopsis
geometry
ST_PixelAsPolygon
(
raster
rast
, integer
columnx
, integer
rowy
)
;
Description
Returns the polygon geometry that bounds the pixel for a particular row and column.
Availability: 2.0.0
Examples
This example returns a raster pixel polygon.
Code
SELECT i, j, ST_PixelAsPolygon(foo.rast, i, j) As b1pgeom
FROM dummy_rast As foo
CROSS JOIN generate_series(1, 2) As i
CROSS JOIN generate_series(1, 1) As j
WHERE rid=2;
Output
i | j | b1pgeom ---+---+----------------------------------------------------------------------------- 1 | 1 | POLYGON((3427927.75 5793244,3427927.8 5793244,3427927.8 5793243.95,... 2 | 1 | POLYGON((3427927.8 5793244,3427927.85 5793244,3427927.85 5793243.95, ..