Public Lab Wiki documentation



NDVI Calculation

1 Authors | 5 Revisions | Talk

Plaza San Martin, visible-infrared-NDVI

Good example in GDAL/Python: http://www.gis.usu.edu/~chrisg/python/2009/lectures/ospy_slides5.pdf

Script for GDAL: http://www.jeremymsmith.us/davidson/NDVI.py

Remember, NDVI is:

Infrared - Visible / Infrared + Visible

GDAL commands

Splice out a single band and save as independent geotiff:

gdal_translate -of GTiff -b 2 morflex-freeflight-geo.tif morflex-freeflight-green.tif

On using NDVI.py, I got this error:

nautilus-2:morflex-lima-freeflight warren$ python NDVI.py Traceback (most recent call last): File "NDVI.py", line 31, in var1 = subtract(band4, band3) ValueError: shape mismatch: objects cannot be broadcast to a single shape

Perhaps we can use this GDAL crop script to make both images the same shape: http://www.enricozini.org/2010/tips/gdal-crop/