scenProc batch processing

When you want to process bigger quantities of data with scenProc the graphical user interface is not always the easiest way to do this. In that case it is much easier if you can call scenProc from a script, for example a batch file. This is already possible for a while, but yesterday I have made some changes to make this mode of running scenProc even more powerful.

Let’s just start with some details on how to run scenProc from the command prompt. Below you see the syntax. The first argument you provide is the configuration file you want to use. The /run argument tells scenProc to directly run the configuration after opening, so that you don’t have to press any buttons to start it. This will also ensure that scenProc automatically closes when it is finished. The /log is optional, but when you provide it the messages from the event log are written to the indicated file when the processing is done. This allows you to check what happened later on.

scenProc myfile.spc /run /log mylog.txt

So far for the batch options that were already available (only the argument to generate the log has changed). What I have added now is that you can also pass additional variables into the scenProc configuration. This makes it possible to use one template scenProc configuration and customize using the variables exactly what will happen.

Let’s give an example. Let’s assume you have a folder with different shp files and you all want to process them with the same scenProc configuration. Then you should call scenProc each time with a different filename as variable. For example:

scenProc myfile.spc /run /log mylog.txt input13.shp

In your configuration file you will also have to make a change. Your configuration file would become like this:

# @0@= test.shp
#
IMPORTOGR|@0@|*|*|NOREPROJ
#
SPLITGRID|AGN
CREATEAGNPOLYVEG|FTYPE=POLYGON|{guid}
WRITEAGNFILES|FSX|texture

As you see in the IMPORTOGR step we don’t provide a filename, but the user variable number surrounded by @. You should always start counting from zero and the number is the order in which you provide the variable from the command prompt. While running scenProc will substitute this special code with the value you passed.

As you can also see I put a special comment at the top of the file. In this comment I also assign a value to the special batch variable. This value in the comment is only used if you run from the GUI, so that way you can still test your configuration. But when running from the command prompt it is ignored.

But of course you can use this to pass other things than file names. You could also use this to process your data in parts. Let’s take this configuration file as example:

IMPORTOGR|country.osm|@0@;@1@;@2@;@3@|*|NORPROJ
#
SPLITGRID|AGN
CREATEAGNPOLYVEG|FTYPE=POLYGON|{guid}
WRITEAGNFILES|FSX|texture

In this case the user variables are used to specify a different bounding box for the data to read. So you can specify different extends every time you call scenProc and thereby process a big area in pieces, without having to preprocess all your data.

I hope this feature is useful and I’m sure some of you will come up with even more interesting ways to use this.

3 thoughts on “scenProc batch processing

  1. Gabriele says:

    Will something like

    IMPORTOGR|e:\SHP_files\@_A1.tif|*|*|NOREPROJ

    work?

  2. Gabriele says:

    IMPORTOGR|E:\Autogen\Houses\SHP\portland_@.shp|*|NOREPROJ

    where all my files have a suffix like _A1.tif, _A2.tif, _A3.tif … _C1.tif, _C2.tif, _C3.tif and so on

  3. Gabriele says:

    Forget the previous comments…

    What filename format did u use in your scenario? Where the 0 part of the filename input*.shp like input0.shp, input1.shp… input13.shp?

    I tried with

    IMPORTOGR|E:\Autogen\Buildings-Flat-Roof\SHP\@0@|*|*|NOREPROJ

    for the following files

    test_A0.shp
    test_A1.shp

    but ScenProc creates autogen only for the A0 file

    thanks Arno!

Leave a Reply to Gabriele Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.