ST_SetValue — 返回修改后的栅格,该栅格是通过设置给定列 x、行 y 像素或与特定几何图形相交的像素的给定波段的值而生成的。波段号从 1 开始,如果未指定,则假定为 1。
raster ST_SetValue(
raster rast, integer bandnum, geometry geom, double precision newvalue)
;
raster ST_SetValue(
raster rast, geometry geom, double precision newvalue)
;
raster ST_SetValue(
raster rast, integer bandnum, integer columnx, integer rowy, double precision newvalue)
;
raster ST_SetValue(
raster rast, integer columnx, integer rowy, double precision newvalue)
;
返回修改后的栅格,该栅格是通过将指定像素的值设置为给定栅格的行和列或几何图形指定波段的新值而生成的。如果未指定波段,则假定为波段 1。
增强:2.1.0 ST_SetValue() 的几何图形变体现在支持任何几何图形类型,而不仅仅是点。几何图形变体是 ST_SetValues() 的 geomval[] 变体的包装器
-- Geometry example SELECT (foo.geomval).val, ST_AsText(ST_Union((foo.geomval).geom)) FROM (SELECT ST_DumpAsPolygons( ST_SetValue(rast,1, ST_Point(3427927.75, 5793243.95), 50) ) As geomval FROM dummy_rast where rid = 2) As foo WHERE (foo.geomval).val < 250 GROUP BY (foo.geomval).val; val | st_astext -----+------------------------------------------------------------------- 50 | POLYGON((3427927.75 5793244,3427927.75 5793243.95,3427927.8 579324 ... 249 | POLYGON((3427927.95 5793243.95,3427927.95 5793243.85,3427928 57932 ...
-- Store the changed raster -- UPDATE dummy_rast SET rast = ST_SetValue(rast,1, ST_Point(3427927.75, 5793243.95),100) WHERE rid = 2 ;