I want to write scripts for Erdas in Python.

I downloaded some Python examples here but I could not make much.

Where can I get the full Help material for Erdas python scripting?


A good documentation can be found here (.pdf). Also look at the Erdas forum here.

Another good resource is ERDAS IMAGINE 2014 Python Examples

  • How to get Erdas Environment in python like home tab? – Satya Chandra Jul 14 '14 at 9:22
  • 1
    My experience has been the same. While ERDAS has managed to integrate some aspects of Python into scripting for their software, there is little to no documentation outside of the examples that you have linked. I have spoke with a few folks that told me to not bother with Python and ERDAS for now. Perhaps your best bet is to use the ERDAS spatial modeler language (gis.usu.edu/unix/imagine/SML.pdf), but this documentation is spartan at best. If you are unfamiliar with the ERDAS spatial modeler language you can create a model in ERDAS and export it as a spatial modeler script. – F_Kellner Jul 14 '14 at 14:08
  • This is the first result when googling for "erdas model builder python3" but all the links in here now give 404's. Do you have any updated links? – majikman Jul 7 '19 at 22:25
  • @majikman no, I don't, sorry – Alex Tereshenkov Jul 8 '19 at 9:40

I've found a work-around to do some Imagine Python script automation for some processes. The documentation is very sparse and I've had trouble adapting the examples to do more complex processes. I do a lot of automation, and have had to use ArcGIS' Spatial Modeler tools, and was looking forward to being able to moving some of the processing over to Imagine since Spatial Modeler still uses the ancient and very limited Grid format from the old Arc/INFO days for its internal processing, and can be very cumbersome and buggy.

With the current state of the documentation, I can't figure out enough to modify more than the most basic operators directly within the model object as they do in the model examples. However, many of the processes I need to do are using what can be more-or-less static spatial models with a set number of inputs and one or two outputs.

For this, I've been able to use the Spatial Model editor within Imagine to build models to do the work I want, then use python to create a temporary copy with the strings in the GMDX file. It's basically a plain-ascii XML document, so this is a simple string manipulation problem - reading the file and replacing the path/filename string with the desired filenames generated in my script.

Then you simply open the modified model as a model object in Python and execute it. I haven't had it work variable numbers of inputs or similar problems, but it works for many applications. Since Spatial Modeler's documentation is better than its Python counterpart, this works well enough to solve many/most of my raster processing problems.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.