<paramdef choice='opt'><type>text </type> <parameter>nodatavalueexpr=NULL</parameter></paramdef>
<paramdef choice='opt'><type>text </type> <parameter>pixeltype=same_as_source</parameter></paramdef>
</funcprototype>
-
- <funcprototype>
- <funcdef>raster <function>ST_MapAlgebra</function></funcdef>
- <paramdef><type>raster </type> <parameter>rast</parameter></paramdef>
- <paramdef><type>text </type> <parameter>expression</parameter></paramdef>
- <paramdef><type>text </type> <parameter>pixeltype</parameter></paramdef>
- </funcprototype>
</funcsynopsis>
</refsynopsisdiv>
254 | 0
254 | 0
</programlisting>
- <para>Create a new 1 band raster of pixel-type 2BUI from our original that is reclassified.</para>
+ <para>Create a new 1 band raster of pixel-type 2BUI from our original that is reclassified and set the nodata value to be 0.</para>
<programlisting>ALTER TABLE dummy_rast ADD COLUMN map_rast2 raster;
UPDATE dummy_rast SET map_rast2 = ST_MapAlgebra(rast,'CASE WHEN rast BETWEEN 100 and 250 THEN 1
WHEN rast = 252 THEN 2
-WHEN rast BETWEEN 253 and 254 THEN 3 ELSE 0 END', '2BUI') WHERE rid = 2;
+WHEN rast BETWEEN 253 and 254 THEN 3 ELSE 0 END', '0', '2BUI') WHERE rid = 2;
SELECT DISTINCT ST_Value(rast,1,i,j) As origval, ST_Value(map_rast2, 1, i, j) As mapval
FROM dummy_rast CROSS JOIN generate_series(1, 5) AS i CROSS JOIN generate_series(1,5) AS j