]> granicus.if.org Git - postgis/commitdiff
Added missing variant of ST_SetValues without nband parameter.
authorBborie Park <bkpark at ucdavis.edu>
Fri, 3 Aug 2012 19:43:16 +0000 (19:43 +0000)
committerBborie Park <bkpark at ucdavis.edu>
Fri, 3 Aug 2012 19:43:16 +0000 (19:43 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@10158 b70326c6-7e19-0410-871a-916f4a2858ee

doc/reference_raster.xml
raster/rt_pg/rtpostgis.sql.in.c

index 3ff1a23d9edca6659344e156f4bb0fe921dda46a..8e17439c0253c06c64100d9bbb99532f35387832 100644 (file)
@@ -4036,6 +4036,17 @@ GROUP BY (foo.geomval).val;
                                                <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>
 
@@ -4053,6 +4064,10 @@ GROUP BY (foo.geomval).val;
                                        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>
index e3c5622bd28fde7cde29ed9594eb2a1f88fb9289..a642365840a3668960c762ee7bfb3d470a2f311e 100644 (file)
@@ -2929,7 +2929,27 @@ CREATE OR REPLACE FUNCTION st_setvalues(
                        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;