[postgis-users] calculate NDVI from multiband raster

Marco Lechner - FOSSGIS e.V. marco.lechner at fossgis.de
Tue Sep 13 17:13:53 PDT 2011


Hi,

I want to calculate the NDVI (vegetation index) from a landsat-sat
imported into rasterenabled postgis. I thought I could use
st_mapalgebra() for this. my raster is stored in one postgis table
having one row but 4 bands within this row (rid=1).

how to access the specific bands to make st_mapalgebra calculate some
new raster?

select st_mapalgebra(rast, '(4-3)/(4+3)') from foo; or
select st_mapalgebra(rast, '(st_band(rast, 4)-st_band(rast,
3))/(st_band(rast, 4)+st_band(rast, 3))') from foo;

does not work

Marco



More information about the postgis-users mailing list