[postgis-users] NDVI Calculation from two bands within one Raster
Pierre.Racine at sbf.ulaval.ca
Tue Mar 27 08:52:02 PDT 2012
> SELECT ST_ValueCount(ST_MapAlgebraExpr(a.rast, 4, b.rast, 3, 'rast1 + rast2'),
> 1, 0.0) FROM nclraster1 a, nclraster1 b; returned 16223 pixels.
> Both bands 3 and 4 now have nodata values of 255.
> How would you remove the nodatavalues from the calculation?
Nodata values, as far as they are properly set in the raster, are NOT part of the computation.
1) Make sure the nodata values are properly set with ST_BandNodataValue()
2) You have to get rid or decide what to do with all those pixels where the sum is equal to 0.
More information about the postgis-users