ST_PixelAsCentroids — 返回栅格波段的每个像素的质心(点几何)以及每个像素的值、X 和 Y 栅格坐标。 点几何是像素表示的区域的质心。
setof record ST_PixelAsCentroids(
raster rast, integer band=1, boolean exclude_nodata_value=TRUE)
;
返回栅格波段的每个像素的质心(点几何)以及每个像素的值、X 和 Y 栅格坐标。 点几何是像素表示的区域的质心。
返回记录格式:geom
geometry,val
双精度,x
整数,y
整数。
当 |
增强:3.2.0 Faster 现在用 C 实现。
更改:2.1.1 更改了 except_nodata_value 的行为。
可用性:2.1.0
--LATERAL syntax requires PostgreSQL 9.3+ SELECT x, y, val, ST_AsText(geom) FROM (SELECT dp.* FROM dummy_rast, LATERAL ST_PixelAsCentroids(rast, 1) AS dp WHERE rid = 2) foo; x | y | val | st_astext ---+---+-----+-------------------------------- 1 | 1 | 253 | POINT(3427927.775 5793243.975) 2 | 1 | 254 | POINT(3427927.825 5793243.975) 3 | 1 | 253 | POINT(3427927.875 5793243.975) 4 | 1 | 254 | POINT(3427927.925 5793243.975) 5 | 1 | 254 | POINT(3427927.975 5793243.975) 1 | 2 | 253 | POINT(3427927.775 5793243.925) 2 | 2 | 254 | POINT(3427927.825 5793243.925) 3 | 2 | 254 | POINT(3427927.875 5793243.925) 4 | 2 | 253 | POINT(3427927.925 5793243.925) 5 | 2 | 249 | POINT(3427927.975 5793243.925) 1 | 3 | 250 | POINT(3427927.775 5793243.875) 2 | 3 | 254 | POINT(3427927.825 5793243.875) 3 | 3 | 254 | POINT(3427927.875 5793243.875) 4 | 3 | 252 | POINT(3427927.925 5793243.875) 5 | 3 | 249 | POINT(3427927.975 5793243.875) 1 | 4 | 251 | POINT(3427927.775 5793243.825) 2 | 4 | 253 | POINT(3427927.825 5793243.825) 3 | 4 | 254 | POINT(3427927.875 5793243.825) 4 | 4 | 254 | POINT(3427927.925 5793243.825) 5 | 4 | 253 | POINT(3427927.975 5793243.825) 1 | 5 | 252 | POINT(3427927.775 5793243.775) 2 | 5 | 250 | POINT(3427927.825 5793243.775) 3 | 5 | 254 | POINT(3427927.875 5793243.775) 4 | 5 | 254 | POINT(3427927.925 5793243.775) 5 | 5 | 254 | POINT(3427927.975 5793243.775)