[postgis-users] NDVI Calculation from two bands within one Raster
Pierre Racine
Pierre.Racine at sbf.ulaval.ca
Tue Mar 27 06:46:03 PDT 2012
You did not really answer my previous questions...
You can easily identify the faulty pixels by changing the expression:
SELECT ST_ValueCount(ST_MapAlgebraExpr(a.rast, 4, b.rast, 3, 'rast1 +
rast2'), 1, 0.0) FROM nclraster1 a, nclraster1 b;
Pierre
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-
> bounces at postgis.refractions.net] On Behalf Of JamesH
> Sent: Tuesday, March 27, 2012 7:28 AM
> To: postgis-users at postgis.refractions.net
> Subject: Re: [postgis-users] NDVI Calculation from two bands within one Raster
>
> NDVI is calculated on reflectance values in these bands, not raw DN. Your inputs
> should already be floating point values, and they should never be less than 0.0 or
> greater than 1.0.
>
> Ok, my raw data was 8BUI which I went back and changed to 64 bit float to try
> get past this but still, using the equation above is returning:
>
> "NOTICE: Neither raster provided has a NODATA value for the specified band
> indices. NODATA value set to minimum possible for 64BF
> ERROR: division by zero
> CONTEXT: SQL statement "SELECT (($1 - $2) /($1 + $2))::double precision"
>
> I went back and re-edited the raw raster image to remove the black areas from
> where it has been geo-rectified but still can't seem to get to grips with what is
> going wrong in the calculation.
>
> --
> View this message in context: http://postgis.17.n6.nabble.com/NDVI-
> Calculation-from-two-bands-within-one-Raster-tp4656995p4660390.html
> Sent from the PostGIS - User mailing list archive at Nabble.com.
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
More information about the postgis-users
mailing list