Import AGN files

Until now the scenProc tool could only be used to create AGN files. But when you want to enhance or view existing AGN files it is also useful to be able to import them again. That feature has been added to the development release versio now. To illustrate how it works I will explain two use cases where this new step is used.

Enhance existing AGN files

Let’s assyme you have made some autogen files before only containing forest polygons. You used a file like this to create this autogen:

IMPORTOSM|schier.osm|*|*
#
SPLITGRID|AGN
#
CREATEAGNPOLYVEG|FTYPE=POLYGON;landuse=forest|{e8b937fd-a1f2-4bd5-8548-2c80d30102af}
#
WRITEAGNFILES|FSX|c:\flightsim\fsx\myscenery\texture

And now you want to add autogen buildings to the same area as well. Of course you could run the entire process again, adding more rules. But now you could also import the existing autogen and add only the new buildings. This is a configuration file that would do that:

IMPORTOSM|schier.osm|*|*
#
IMPORTAGN|c:\flightsim\fsx\myscenery\texture
#
SETAGNBUILDINGHEIGHT|*|1.0;0.0;0.0;0.0
#
SPLITGRID|AGN|building=*
#
CREATEAGNGENBUILD|FTYPE=POLYGON;building=*;FWIDTH<20|{5ae04eb6-934c-4f63-bb48-5e7dee601212}|MAXRATIO=2
CREATEAGNGENBUILD|FTYPE=POLYGON;building=*;FWIDTH>20|{6089A0BD-CED1-4c47-9A9E-64CDD0E16983}
#
WRITEAGNFILES|FSX|c:\flightsim\fsx\myscenery\texture

What happens here is that after loading the source data, you also load the existing AGN files. This means that all autogen defined in there is added to your data cells and when you create additional autogen it will be added to what is already there. So when you export it agian you have the old and the new autogen.

Export AGN files

How scenProc normally works is that you load vector data, this is then stored as internal vector features. Using the different steps you then create autogen objects out of these. In the example above the autogen objects were imported again, but in that case they are not converted to features, they stay as autogen. If you want to export the AGN to shapefiles for example, you would have to convert them back to features. This configuration shows how that can be done:

IMPORTAGN|c:\flightsim\fsx\myscenery\texture|CREATEFEATURES
#
MERGEGRID
#
EXPORTSHP|*|my_agn

The additional CREATEFEATURES option tell the tool to make features again. And these can then be export to SHP. The MERGEGRID step is optional, but what it does is the reverse of the SPLITGRID step, it combines all different cells into one big cell. This means you get one SHP file for the autogen, else you would get a SHP file per tile

Leave a 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.