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<gmdxfile 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:
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
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)