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,524 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.

 

HOW THE TOOL WORKS? 

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

 

CREATE INPUT FILE

 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

 ‘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.

  

EXECUTION MESSAGES

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

Success:

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

**** success: Output generated successfully! 

Failure:

An error message appears in the command prompt

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

 Skipped:

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.

 

Conclusion:

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!!

 

  

Acknowledgement:

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

Ideation: Vindhya Perepa

Article: FIRE Hawks team

 

Comments
by Technical Evangelist
on ‎01-17-2017 03:07 AM

We have been able to run more then one ini file and didn't come across the issue. Is this issue consistent and if so could you let us know the exact steps to reproduce it?

 

As of now the current implementation only supports files in a single same directory and not nested files.

 

Thanks,

Pramod

 

 

by
on ‎05-07-2020 09:44 PM

Hi Can i check does this work for Imagine 2020? 

by Technical Evangelist
on ‎05-14-2020 10:42 PM

It should definitely work with ERDAS IMAGINE 2020.