[postgis-users] NDVI Calculation from two bands within one Raster

JamesH james.holmes at newcastle.ac.uk
Wed Apr 11 07:56:23 PDT 2012

Sorry to keep reviving this thread, espcially with a basic question.

I am using:
SELECT ST_MapAlgebraExpr(a.rast, 4, b.rast, 3, '([rast1] - [rast2])
/([rast1] + [rast2])::float') 
WHEN (rast1 + rast2 = 0) THEN = 999 ELSE ([rast1] - [rast2]) /([rast1] +
[rast2])::float END'
FROM ndvi a, ndvi b;

Where the WHEN statement is being used to prevent the error division by
However this returns: syntax error at or near "WHEN"

Can anyone advise on where I'm structuring this query wrongly.


GIS Undergraduate
View this message in context: http://postgis.17.n6.nabble.com/NDVI-Calculation-from-two-bands-within-one-Raster-tp4656995p4832397.html
Sent from the PostGIS - User mailing list archive at Nabble.com.

More information about the postgis-users mailing list