NDVI Scripting

I've been tasked with running NDVI calculations on 1500-odd 4 band orthophotos, and I'm having a hard time figuring out the script in Global Mapper to do so.
my script works, however, the results are wrong. What am i missing? Here's the script I'm using.

The attached image shows 1) The Original Image. 2) Manual NDVI Processing via the raster calculator in GM. 3) The third pane shows the results I'm getting via the script.

GLOBAL_MAPPER_SCRIPT VERSION=1.00
UNLOAD_ALL

// Loop over all .tif files in a folder and convert them
DIR_LOOP_START DIRECTORY="E:\GM_Scripting_Test\" FILENAME_MASKS="*.tif" RECURSE_DIR=NO

// Import 
IMPORT FILENAME="%FNAME_W_DIR%"
//Calculate NDVI
APPLY_FORMULA FILENAME="*" FORMULA="NDVI" OUTPUT_GRID=YES
//Export Raster
EXPORT_ELEVATION FILENAME="%DIR%%FNAME_WO_EXT%_ndvi.tif" TYPE=GEOTIFF
UNLOAD_ALL

// End the loop
DIR_LOOP_END



Answers

  • bmg_bob
    bmg_bob Global Mapper Programmer
    Hello,

    First, I recommend getting the latest release of your version of Global Mapper.  Make sure that your APPLY_FORMULA command is set up the same way as the Raster Calculator was.  You are accepting a lot of default values, so it might be a good idea to make the parameter values explicit.

    Cheers,
    Bob