ST_PixelAsPolygons — 返回与每个像素的值、X 和 Y 栅格坐标一起限定栅格波段的每个像素的多边形几何。
setof record ST_PixelAsPolygons(
raster rast, integer band=1, boolean exclude_nodata_value=TRUE)
;
返回与每个像素的值(双精度)、X 和 Y 栅格坐标(整数)一起限定栅格波段的每个像素的多边形几何。
返回记录格式:geom
geometry,val
双精度,x
整数,y
整数。
当 |
ST_PixelAsPolygons 为每个像素返回一个多边形几何。这不同于 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))