<paramdef><type>boolean </type> <parameter>keepnodata=FALSE</parameter></paramdef>
</funcprototype>
+ <funcprototype>
+ <funcdef>raster <function>ST_SetValues</function></funcdef>
+ <paramdef><type>raster </type> <parameter>rast</parameter></paramdef>
+ <paramdef><type>integer </type> <parameter>columnx</parameter></paramdef>
+ <paramdef><type>integer </type> <parameter>rowy</parameter></paramdef>
+ <paramdef><type>integer </type> <parameter>width</parameter></paramdef>
+ <paramdef><type>integer </type> <parameter>height</parameter></paramdef>
+ <paramdef><type>double precision </type> <parameter>newvalue</parameter></paramdef>
+ <paramdef><type>boolean </type> <parameter>keepnodata=FALSE</parameter></paramdef>
+ </funcprototype>
+
</funcsynopsis>
</refsynopsisdiv>
For variant 2, the specific pixels to be set are determined by the <varname>columnx</varname>, <varname>rowy</varname> pixel coordinates, <varname>width</varname> and <varname>height</varname>. If <varname>keepnodata</varname> is TRUE, those pixels whose values are NODATA will not be set with the corresponding value in <varname>newvalueset</varname>. See example Variant 2.
</para>
+ <para>
+ Variant 3 is the same as Variant 2 with the exception that it assumes that the first band's pixels of <varname>rast</varname> will be set.
+ </para>
+
</refsection>
<refsection>
RAISE EXCEPTION 'Values for width and height must be greater than zero';
RETURN NULL;
END IF;
- RETURN st_setvalues($1, $2, $3, $4, array_fill(newvalue::double precision, ARRAY[height, width]::int[]), NULL, $8);
+ RETURN st_setvalues($1, $2, $3, $4, array_fill($7, ARRAY[$6, $5]::int[]), NULL, $8);
+ END;
+ $$
+ LANGUAGE 'plpgsql' IMMUTABLE;
+
+-- cannot be STRICT as newvalue can be NULL
+CREATE OR REPLACE FUNCTION st_setvalues(
+ rast raster,
+ x integer, y integer,
+ width integer, height integer,
+ newvalue double precision,
+ keepnodata boolean DEFAULT FALSE
+)
+ RETURNS raster AS
+ $$
+ BEGIN
+ IF width <= 0 OR height <= 0 THEN
+ RAISE EXCEPTION 'Values for width and height must be greater than zero';
+ RETURN NULL;
+ END IF;
+ RETURN st_setvalues($1, 1, $2, $3, array_fill($6, ARRAY[$5, $4]::int[]), NULL, $7);
END;
$$
LANGUAGE 'plpgsql' IMMUTABLE;