Ho I see better now. My email was not showing your code. You have to convert minVal & maxVal to text:
newrast := ST_MapAlgebraExpr(rast, '8BUI', 'CASE WHEN rast1 < 0 THEN null ELSE (((rast)-(' || minVal::float8 || '))/((' || maxVal::float8 || ')-(' || minVal::float8 || '))) END'); Pierre > -----Original Message----- > From: postgis-users-boun...@postgis.refractions.net [mailto:postgis-users- > boun...@postgis.refractions.net] On Behalf Of DavidRA > Sent: Monday, February 27, 2012 10:19 AM > To: postgis-users@postgis.refractions.net > Subject: Re: [postgis-users] Problem using ST_MapAlgebraExpr > > Hi, it's very simple, like any other normalization: we have some values (in > this > case, the values of each cell of the input raster) and want to tranform them > into > others between 0 and 1. The minimum value of the raster will be transformed as > 0, and the maximum as 1. And the formula used is (cellValue - > minValue)/(maxValue - minValue). > > An example for a 2x2 raster: > > -Input raster: > > 2 3 > 6 4 > > -Output raster: > > 0 0'25 > 1 0'5 > > I hope this is clear enough, else let me know and I'll try to be more > especific. > Thanks. > > -- > View this message in context: http://postgis.17.n6.nabble.com/Problem-using- > ST-MapAlgebraExpr-tp4514561p4515113.html > Sent from the PostGIS - User mailing list archive at Nabble.com. > _______________________________________________ > postgis-users mailing list > postgis-users@postgis.refractions.net > http://postgis.refractions.net/mailman/listinfo/postgis-users _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users