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

JamesH james.holmes at newcastle.ac.uk
Mon Mar 26 08:59:38 PDT 2012

SELECT ST_MapAlgebraExpr(a.rast, 4, b.rast, 3, '(rast1 - rast2) /(rast1 +
rast2)::float') FROM nclraster1 a, nclraster1 b;

Returned "Neither raster provided has a NODATA value for the specified band
indices.  NODATA value set to minimum possible for 8BUI" 

Updated NoDataValues for bands 3 and 4 to 255 (were previously blank) and
when re-ran, returns:
"ERROR:  division by zero
CONTEXT:  SQL statement "SELECT (($1 - $2) /($1 + $2)::FLOAT)::double


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

More information about the postgis-users mailing list