Tag Archives: batch

Workaround for Arcgis batch models (or what to do when batching a model just fails)

14 Feb

Ok, so many of you are probably already aware that when you create a model in Arcgis in order to batch it you need to make the variables lists. However, there are sometimes that this just fails and it not allows you to batch your model. I encountered this problem working with a quite complicated model and looking for different solutions I figured out this one. You can just create a script instead of a model, but if you don’t have time or you are not a super scripting nerd 😀 there is another way to make it work. Is actually quite similar to the way you do macros in IDRISI.

For the sake of explanation here Im going to put as example a simple process (create a buffer):

Let’s say you create your model and you want to batch process it.

1.Open the command line either in Arcmap or Arccatalog. To make sure that your model works well before you create your workflow in Excel, enter the parameters of your model in the command line and run it.

2. Once you are sure it is working properly, copy the parameters to a worksheet in excel.

(If you are using arccatalog you can set the absolute paths to your layers, but if you added all the information into an arcmap project the model will take the relative paths so in the parameters you can just input the name of the file rather than the whole path)

3. Once in excel you can just drag down the values filling up the parameters, modifying the names of the files you want to run in subsequent models.

4. Delete all the other sheets in the book (Sheet1,2 and so on TAB/right click/delete). Save as .cvs (Comma delimited).

(This will allow you to modify in the next step the file and save it directly to .txt)

5. Open it your word processor, click Find and Replace. Replace “,” for one space.

6. Save the document as .TXT

7. Open it in Notepad.

8. Copy and paste all in the command line and run it! (you are ready to go for a nice coffee while the machine works for you :D)

You can do the same with more complex models, just add the parameters that are necessary in your model.

Have a great day!

How to reclassify raster with batch file in Idrisi

30 Nov

Ok guys, today I had to reclassify a raster to create new ones with the values I needed. They were around 226 so I needed to make it an automatic process.  To do this in Idrisi you can create a batch file or macro. Although the process is fairly simple there are always good tips that can save you loads of time.

The way to start is to know the structure of module you want to reproduce in the macro. For “reclass” in idrisi you need the next parameters:

1.  x (to indicate that you are using macro mode)

2. File type (i for image, v for vector or a for attribute value file)

3. the input filename

4. output filename

5. classification type (1 for equal interval, 2 for user defined and 3 for file mode)

In my case, because I wanted to do my own classification I used type 2 in which you can repeat steps 6 to 8:

6. new value to be assigned to the old ones

7. old value (ranging from…)

8. old value (to those just less than…)

9. -9999 to indicate the end of the sequence

10 type of output data, 1 for integer and 2 for real.

To create the macro I use excel inputting these parameters to each cell in the datasheet:



Because you need to transform this into a macro file in Idrisi you have to save it as text. Any kind of text I have tried to save it directly from excel mess up the result so I found out that if better to do this:

I saved it as .CVS comma delimited, I opened it in word and did find and replace commas for space and then saved it as plain text.

Finally, you just open it with Edit in Idrisi save it as .IML and run the macro as usual!

I hope this is of some help because when you have 1,000,000 files to reclass it can be really handy!

Thanks to Boyd Zapatka in Clark Labs for his help!!! 🙂