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

JamesH james.holmes at newcastle.ac.uk
Mon Mar 26 08:36:25 PDT 2012


> 1) 2) Do you have a column of type "raster" in table "nclraster1"?
Yes rid and rast.

> 3) Is this raster tiled? (or Do you have more than one row in
> "nclraster1"?)
No , only 1 row in nclraster1

> 4) What if the results of SELECT (ST_SummaryStats(rast)).*FROM nclraster1
count(bigint)= 49729, sum(dbprecision)= 432970, mean(dbprecision)=
8.706589..., stdev(dbprecision)= 10.15282..., min(dbprecision)= 0,
max(dbprecision)= 236

> 5) What is the result of:SELECT PostGIS_Full_Version();
"POSTGIS="2.0.0SVN" GEOS="3.3.2dev-CAPI-1.7.2" PROJ="Rel. 4.6.1, 21 August
2008" GDAL="GDAL 1.9dev, released 2011/01/18" LIBXML="2.7.8" USE_STATS"

>6) Your query should probably more look like (if you have a recent version
of PostGIS):
> SELECT ST_MapAlgebraExpr(a.rast, 4, b.rast, 3, '([rast1] - [rast2]) /
> ([rast1] + [rast2])::float')
>FROM nclraster1 a, nclraster1 b;

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

ERROR:  syntax error at or near "["
LINE 1: SELECT (([$1] - [$2]) / ([$1] + [$2])::FLOAT)::double precis...
                 ^
QUERY:  SELECT (([$1] - [$2]) / ([$1] + [$2])::FLOAT)::double precision

Regards,
James

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



More information about the postgis-users mailing list