ST_PixelAsPolygons — 返回限定栅格带的每个像素的多边形几何图形,以及每个像素的值、X和Y栅格坐标。
setof record ST_PixelAsPolygons(
raster rast, integer band=1, boolean exclude_nodata_value=TRUE)
;
返回限定栅格波段的每个像素的多边形几何图形以及每个像素的值(双精度)、X和Y栅格坐标(整数)。
Return record format: geom
几何体 , val
double precision, x
integer, y
integers.
![]() | |
什么时候 |
![]() | |
ST_PixelAsPolygons为每个像素返回一个多边形几何体。这与ST_DumpAsPolygons不同,在ST_DumpAsPolygons中,每个几何体表示一个或多个具有相同像素值的像素。 |
可用性:2.0.0
增强:2.1.0添加了可选参数EXCLUDE_NODATA_VALUE。
已更改:2.1.1更改了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))