ST_SetValue — Returns modified raster resulting from setting the value of a given band in a given columnx, rowy pixel or at a pixel that intersects a particular geometric point. Band numbers start at 1 and assumed to be 1 if not specified.
raster ST_SetValue(
raster rast, geometry pt, double precision newvalue)
;
raster ST_SetValue(
raster rast, integer bandnum, geometry pt, double precision newvalue)
;
raster ST_SetValue(
raster rast, integer columnx, integer rowy, double precision newvalue)
;
raster ST_SetValue(
raster rast, integer bandnum, integer columnx, integer rowy, double precision newvalue)
;
Returns modified raster resulting from setting the specified pixel value to new value for the designed band given the row column location or a geometric point location. If no band is specified, then band 1 is assumed.
Setting by geometry currently only works for points. |
Changed: 2.0.2 Geometry variant of ST_SetValue() now checks to make sure that the input raster and geometry have the same SRID
-- 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 ;