ST_AsRasterAgg — 这是一个聚合函数。将 PostGIS 几何图形转换为新的栅格图像。
raster ST_AsRasterAgg(
geometry geom, double precision val, raster ref, text pixeltype, double precision nodataval, text uniontype, boolean touched)
;
返回一个单波段栅格,包含所有输入几何图形及其关联值的渲染结果。
可用性:3.6.0
WITH inp(g,v) AS ( VALUES ( ST_Buffer(ST_MakePoint(10,0), 10), 1 ), ( ST_Buffer(ST_MakePoint(20,0), 10), 2 ) ), agg AS ( SELECT ST_AsRasterAgg( g, v, ST_MakeEmptyRaster(0,0,0,0,1.0), '8BUI', 99, 'SUM', true ) r FROM inp ) SELECT ST_Width(r) w, ST_Height(r) h, ST_Value(r,'POINT(5 0)') v5_0, ST_Value(r,'POINT(15 0)') v15_0, ST_Value(r,'POINT(25 0)') v25_0 FROM agg; w | h | v5_0 | v15_0 | v25_0 ----+----+------+-------+------- 30 | 20 | 1 | 3 | 2 (1 row)