Showing results for 
Search instead for 
Do you mean 

Now is the time to go happy-go-lucky with ERDAS IMAGINE

by Technical Evangelist on ‎07-14-2016 04:11 AM - edited on ‎02-24-2020 05:09 AM by Community Manager (5,540 Views)

Spatial Modeler in ERDAS IMAGINE is evolving with new functionalities covering various aspects of Geospatial Technology. The robust extensible processing architecture of Spatial Modeler enriches the user experience by making use of the same model with different datasets. It is also possible to execute multiple models in the form of daisy-chain such that output of one model can be fed as input to next model. But all these possibilities require manual triggering/monitoring of the executions. Wouldn’t it sound exciting, if there was a mechanism which would automatically trigger and monitor the executions?

ERDAS IMAGINE has been providing powerful tools for automating tasks to maximize productivity. In similar lines, we introduce here one such solution in the form of a tool called WATCH BUCKET. WATCH BUCKET monitors a particular folder 24x7 for any new files added. As soon as new files are detected in the folder WATCH BUCKET triggers Spatial Modeler execution without launching ERDAS IMAGINE and finally output is ready for the analysis. Doesn’t this make someone Happy-Go-Lucky?

Excited to see how the tool works? Here we go.



Watch Bucket tool contains two tabs namely Create Input file and Run.



 Create Input file tab is to create an INI file with specified field inputs that are required to monitor a folder and run spatial models.

  • Batch command syntax to run in Watch bucket tool is
  •  smprocess <gmdx file path> ‘<Input Port Name>=%InputFilePath%’  ‘<Output Port Name > = %OutputFilePath%’
  • Clicking on ‘Create ini’ button will create an INI file in the specified path. 


 ‘Run’ tab is to invoke a python script which takes INI file as an input to monitor a folder and execute spatial models automatically.

  • Click ‘Run’ button in Run tab to invoke the python script. Command prompt will open indicating python script started watching a specific folder.

 Whenever a new file is added to the watch folder, which has an extension specified in the “Input file extension” field (for e.g.:  img), batch command starts running automatically with the newly added file as input.


Spatial Model execution through the batch command happens automatically without even launching ERDAS IMAGINE. The output file is generated with the same name as input file. Output file extension will be taken from the ‘Output file extension’ field.



Once the watch bucket executes a batch command, execution messages appear for the following three cases based on the input file added:

  • Success
  • Failure
  • Skipped


If the spatial model ran successfully then a success message appears in the command prompt.

**** success: Output generated successfully! 


An error message appears in the command prompt

*** error: Output is not generated! Please check if the command is correct:


In case if the newly added file extension doesn’t match with the ‘Input file extension’ specified in the INI file then following message appears

File skipped! :Reason: File extension is not img


This tool can be downloaded from here.



To conclude, by using Watch Bucket you can simply add new files directly to a folder. Watch bucket would automatically execute the spatial model and produce output for you without even launching ERDAS IMAGINE!!




Concept: Frank Obusek (Staff Customer Application Engineer, U.S. Pre-Sales)

Ideation: Vindhya Perepa

Article: FIRE Hawks team


on ‎08-16-2016 07:45 AM

 Love to give this a go but apparently I don't have access to the bitbucket repository. Can this be enabled?

by Technical Evangelist
on ‎09-01-2016 04:01 AM

We have changed the link now.  Please give it a try now.

on ‎09-01-2016 04:15 AM

Perfect; ta so. J

on ‎01-12-2017 08:32 AM



Any reason why this isn't working? Here's the ini file:

ImagineHome=C:\Program Files\Hexagon\ERDAS IMAGINE 2016
batchcommand=smprocess C:\Support\watch_ndvi\watch_ndvi_l8.gmdx 'RasterFilenameIn=%InputFilePath%'  'RasterFilenameOut = %OutputFilePath%'

And here's the report:

WatchBucket is monitoring the folder: c:\support\watch_ndvi
 ****** New file detected *******
Running :  c:\support\watch_ndvi\lc82020242013189lgn00-msi_subset.img
Reading the Settings.ini file from:  C:\Support\watch_ndvi\testndvi1.ini
smprocess path:  c:\program files\hexagon\erdas imagine 2016/bin/x64URelease
WatchFolder:  c:\support\watch_ndvi
OutputFilePath:  c:\support\watch_ndvi\output_watch_ndvi\lc82020242013189lgn00-msi_subset.img
Batch Command:  smprocess C:\Support\watch_ndvi\watch_ndvi_l8.gmdx 'RasterFilenameIn=c:\support\watch_ndvi\lc82020242013189lgn00-msi_subset.img'  'RasterFilenameOut = c:\support\watch_ndvi\output_watch_ndvi\lc82020242013189lgn00-msi_subset.img'
*** error: Output is not generated! Please check if the command is correct: smprocess C:/Support/watch_ndvi/watch_ndvi_l8.gmdx 'RasterFilenameIn=c:/support/watch_ndvi/lc82020242013189lgn00-msi_subset.img'  'RasterFilenameOut = c:/support/watch_ndvi/output_watch_ndvi/lc82020242013189lgn00-msi_subset.img'***

Anything look off there? The model is correctly located. 





by Technical Evangelist
on ‎01-12-2017 08:56 AM

Hello Johnnie,


Could you please check if the following command works and generates an output if run from the command line.