ST_PixelAsPolygons — Retorna o polígono que limita cada pixel de uma banda raster ao longo do valor, as coordenadas raster X e Y de cada pixel.
setof record ST_PixelAsPolygons(
raster rast, integer band=1, boolean exclude_nodata_value=TRUE)
;
Retorna o polígono que limita cada pixel de uma banda raster ao longo do valor (precisão dobrada), as coordenadas (inteiras) raster X e Y de cada pixel.
Return record format: geom
geometry, val
double precision, x
integer, y
integers.
When |
ST_PixelAsPolygons retorna um polígono para cada pixel. Isto é diferente da ST_DumpAsPolygons, onde cada geometria representa um ou mais pixeis com o mesmo valor. |
Disponibilidade: 2.0.0
Melhorias: 2.1.0 o argumento opcional exclude_nodata_value foi adicionado.
Alterações: 2.1.1 Mudança no comportamento do exclude_nodata_value.
-- get raster pixel polygon SELECT (gv).x, (gv).y, (gv).val, ST_AsText((gv).geom) geom FROM (SELECT ST_PixelAsPolygons( ST_SetValue(ST_SetValue(ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 0.001, -0.001, 0.001, 0.001, 4269), '8BUI'::text, 1, 0), 2, 2, 10), 1, 1, NULL) ) gv ) foo; x | y | val | geom ---+---+----------------------------------------------------------------------------- 1 | 1 | | POLYGON((0 0,0.001 0.001,0.002 0,0.001 -0.001,0 0)) 1 | 2 | 1 | POLYGON((0.001 -0.001,0.002 0,0.003 -0.001,0.002 -0.002,0.001 -0.001)) 2 | 1 | 1 | POLYGON((0.001 0.001,0.002 0.002,0.003 0.001,0.002 0,0.001 0.001)) 2 | 2 | 10 | POLYGON((0.002 0,0.003 0.001,0.004 0,0.003 -0.001,0.002 0))