Generating a XML file for a specific operator

Hello everyone,

I’m a new user of SNAP. I used the graph builder which is a great tool. The problem is, when the operator you want isn’t available with the graph GUI, it’s a bit hard to create an xml file of it based on the xml example associated with the operator (let’s say, Mosaic).

My question is, can a “xml builder” be added ? The same as already present inside the graph builder would be great.
As I tune my operator threw the GUI adding variables, names etc, it would be great if I could save it as a XML file.

Maybe it’s just because I began SNAP recently, but sometimes, it’s hard to define what a variable name should be in the xml file.


Talking about requests of this type, some softwares (IDRISI just to name one) constantly updates a “log” file that contains all the operations performed by the users. But it is not just a useless logfile, it can be used by IDRISI as a script that is able to redo the exact same steps.

It is super usefull because thanks to this type of features, it is easy to create a script. We just need to do steps manually, then look into the logfile and select the interesting part for bash processing.

I would love to see other RS softwares able to do it.

1 Like

Hi madjidh,

The Graph Builder is actually the xml builder. Unfortunately, as you have noticed, not all operators are compatible with it. This originates from the fact that the Graph Builder was originally developed in NEST and only intended for SAR operators. Things still need to be harmonized so that everythings is compatible. We have it on the agenda. Might happen this year.

To know how the xml should look like for an operator you can go the the command line and type

gpt <OperatorName> -h
This will print the help and will give you a xml template.
The name of the operator you get from the about box (Help / About) of the operator.

The parameters in the template can be replaced by those shown when you click on File / Display Parameters

In general you are right, things can be improved.
Maybe those two guides are of interest for you:


That sounds really useful - do you have a link that would explain how that is used in practise?

@mengdahl More than that. I can show you an example. Give me a little time to make it as clear as possible

@mengdahl @marpet I hope this is understandable enough

Here’s IDRISI :

I just opened the 3 first bands of some satellite data

One thing I can do is simply making a color composite

Now, looking at my working folder, we can see a log file :

Once opened, we can see exactly what we did

As we can see, I opened my 3 images (just for visualization) then I created a composite using the function “COMPOSITE”

Oh noooo. I accidentaly deleted my composite ! No problem : i can simply create a .iml file with the composite “action”

then I run it in the run macro module of IDRISI


Boom. I have my composite again.

Of course, the main goal of the log file is having a footprint of what was performed. But it is also very handy to create macro based on something that was performed “by hand”.

Note that the help of each function of IDRISI also explain how to create a macro of this function. Example :

If something is not clear, I can be more precise.



Hi Quentin, it’s nice example, but would you please to clarify the macro! this is the first thing, and the other issue, is ti IDRISI free software? And in which phase generally has things should be improved the SNAP in case could be added to SNAP?

Dose this mean each operator doesn’t exist within gb, could be used in this way? But I confused about read and writ? how could be added?

And , how it’s possible to combine it with other xml file to implement for instance double operators in one touch?

Thanks for this explanation.
Actually, we had something similar in mind some years ago.
Unfortunately, this was not implemented.

Default Read and Write operators are added automatically, only if you want to specify a certain format you need to add them.

You can combine multiple operators by you copying together the <node> section.
It is shown here:

1 Like

I understand that for some situations, it may require a lot of work to develop it.

I still persist to think that it can be a nice addition, though I understand that you have other priorities

Each action performed in IDRISI can be performed using a command line documented in the help of each function. The last figure I showed shows how to create a command related to making a composition. All these command lines can be gathered in a file, that IDRISI can interpret to perform them.

No. Moreover, now merged into TerrSet software, price increased a lot. In addition, it does not support Linux so it is barely never used in research.

All of them :slight_smile:

1 Like