ScenProc

From FSDeveloper Wiki
Jump to: navigation, search

Scenery Processor, or scenProc for short, is a tool to process GIS data and create scenery output from it. It can for example import vector data and create autogen AGN files from this data. The tool is driven by the configuration file, which can be edited in the GUI of the tool.

Getting scenProc

Prerequisites

Installation

At this moment scenProc is still under development, but a beta version is already available. Please be aware that this version might have bug left. You can download the latest development release here.

The development release also contains other tools that I made, like ModelConverterX. Just unzip all of these tools to a folder of your choice. That's all the installation.

To be able to read shapefiles, you need to have the Microsoft Access Database Engine 2010 installed. Be aware to install the right version, if you are running a 64 bit OS, you need to have the 64 bit driver installed. If you get an error while installing that a 32 bit Microsoft Office is installed, you can run the installer in passive mode to still install the driver:

 AccessDatabaseEngine_X64.exe /passive

User interface

The graphical user interface of scenProc is shown below. It consists of three main components:

  • Toolbar with buttons for common actions. This offers the way to create, save and load configuration files, to start processing the configuration and to set the options.
  • Text editor where the configuration can be defined. The text editor has features like auto completion and tooltips showing help. When you put your mouse over a processing step, the tooltip will show the help text for that step. If you put it over a GUID the friendly name of the GUID will be shown as tooltip.
  • Event log that shows messages and progress.

Scenproc ui.jpg

Validation

While typing your configuration in the text editor the configuration file is automatically validated. This means that there is a mistake in the file this will be reported in the event log at the bottom of the screen. It is for example validated if the correct amount of arguments are specified for a step, if the file specified exists or if the specified GUID is valid. As long as there are errors while validating the configuration file, you can not run the configuration.

Options

Below the options of scenProc are shown. In the options you need to specify the paths to FSX and to the FSX SDK. Without these paths the auto completion functionality is not working. Besides that some parameters of algorithms can be set in the options as well.

40px-Emblem-important.png Make sure you specify the FSX SDK root folder, not the Autogen SDK folder!

Scenproc options.jpg

Batch mode

It is also possible to run the tool like a command line tool. In that case it should be started from the command line providing the name of the configuration file and the additional argument /run. In this case the configuration file will be ran directly after opening and the tool will automatically close once finished.

Configuration file

In the configuration file (plain text file, usually with the extension .spc) you specify what data you want to process and how you want to process it. In the next section the available commands are described.

All lines starting with a hash (#) are comments and are ignored. Each lines starts with the name of the action you want to perform, followed by arguments of needed. The arguments are separated with a pipe (|) symbol.

Filter

Some processing commands take a filter as input. With this filter you can select the features that match certain attributes. Please be aware that attribute names are values are case sensitive, so be aware that you type them in the correct case. You specify the filter with the syntax:

 ATTRIBUTENAME=VALUE

There are four operators that can be used:

  • Equal (=)
  • Not equal (!)
  • Greater (>)
  • Smaller (<)

If you want to specify multiple conditions you separate them with semicolons (;). All features that match all of those conditions are then selected.

 ATTRIBUTENAME1=VALUE1;ATTRIBUTENAME2=VALUE2

Besides the attributes that are present in the source data you imported, there are some special attributes that scenProc adds while importing the data. The table below indicates which attribute is added to which type of feature.

Attribute Description Polygon Line Point
FTYPE type of feature (POINT/LINE/POLYGON) X X X
FROMFILE name of the source file that the feature comes from (without path) X X X
FWIDTH width of the bounding box around the object (in meters) X
FLENGTH length of the bounding box around the object (in meters) X
FAREA area of the bounding box around hte objects (in square meters) X
FMINSIDE the length of the shortest edge of the feature X X
FNUMVERT the number of vertices in the feature X X
FNUMPERPANG the number of 90 degree angles in the feature X
FNUMNOTPAR The number of edges that do not have another edge that is parallel X
FCONVEX 1 if polygon is convex, 0 if polygon is concave X

Use can use an asterisk (*) to select all features.


Available processing steps

Below the available processing steps in scenProc are listed. For more detailed help enter the step in your configuration file and hover over the command to see the tooltip showing the help.

IMPORTSHP 
Imports features from an ESRI Shapefile.
IMPORTOSM 
Imports features from an OpenStreetMap OSM file.
IMPORTKML 
Imports features from a KML file.
IMPORTDXF 
Imports features from a DXF file.
SPLITGRID 
Splits the features into cells with a given size.
SCALEFEATURES
Scale features based on two reference points.
SETAGNBUILDINGHEIGHT 
Sets the building height properties for the AGN cell.
SETAGNBUILDINGTEXTURE 
Sets the texture to be used for autogen buildings in this cell.
SETAGNROWHOUSETEXTURE 
Sets the texture to be used for autogen row houses in this cell.
SETVEGETATIONSETTINGS 
Sets the FS2004 style vegetation settings for the cell.
CREATEAGNPOLYVEG 
Create autogen polygonal vegetation from the selected features.
CREATEAGNPOLYBUILD 
Create autogen polygonal buildings from the selected features.
CREATEAGNRECTVEG 
Create autogen rectangular vegetation from the selected features.
CREATEAGNGENBUILD 
Create generic autogen buildings from the selected features.
CREATEAGNROWHOUSE 
Create autogen row houses from the selected features.
CREATEAGNLIBOBJ 
Create autogen library objects from the selected features.
WRITEAGNFILES 
Write the created autogen objects to AGN files. This should always be the last command when making autogen.
ADDATTRIBUTE 
Add a new attribute with the given value to the selected features.
REMOVEATTRIBUTE 
Remove the given attribute from the selected features
REPLACEPOLYGONBYBUILDINGRECTANGLES 
Replaces polygons by building rectangles fitting the original polygon.
REPLACEPOLYGONBYVEGETATIONRECTANGLES 
Replaces polygons by rectangles covering the same area.
EXPORTSHP 
Exports the fetures to an ESRI Shapefile.

Examples

FSX autogen from OpenStreetMap shapefiles

This examples shows how FSX autogen can be created from OpenStreetMap shapefiles downloaded from GeoFabrik.

 # Schiermonnikoog autogen test
 IMPORTSHP|natural_schier.shp|NOREPROJ
 IMPORTSHP|buildings_schier.shp|NOREPROJ
 #
 SPLITGRID|AGN
 #
 SETAGNBUILDINGHEIGHT|1.0;0.0;0.0;0.0
 SETAGNBUILDINGTEXTURE|autogen_NL
 #
 CREATEAGNPOLYVEG|FTYPE=POLYGON;type=forest|{e8b937fd-a1f2-4bd5-8548-2c80d30102af}
 CREATEAGNGENBUILD|FTYPE=POLYGON;FROMFILE=buildings_schier.shp;FWIDTH<20|{5ae04eb6-934c-4f63-bb48-5e7dee601212}|MAXRATIO=2
   CREATEAGNGENBUILD|FTYPE=POLYGON;FROMFILE=buildings_schier.shp;FWIDTH>20|{6089A0BD-CED1-4c47-9A9E-64CDD0E16983}
 CREATEAGNROWHOUSE|FTYPE=POLYGON;FROMFILE=houses_schier.shp
 CREATEAGNLIBOBJ|FTYPE=POINT;type=light|{0017a263-464f-14fd-f77f-2996fed44864}
 #
 WRITEAGNFILES|FSX|c:\flightsim\nl2000\nl2k_v4_resample_FR\texture

FS2004 autogen from shapefiles

This example shows how to create FS2004 autogen from a set of shapefiles that each contain a specific feature type.

 IMPORTSHP|vegetation.shp|NOREPROJ
 IMPORTSHP|libobj.shp|NOREPROJ
 IMPORTSHP|building.shp|NOREPROJ
 #
 REPLACEPOLYGONBYVEGETATIONRECTANGLES|FROMFILE=vegetation.shp|0.0005|0.25|0.25
 #
 SPLITGRID|AGN|FROMFILE=building.shp
 #
 SETAGNVEGETATIONSETTINGS|1|2|0.5|1.0|6;12|5;20
 #
 CREATEAGNRECTVEG|FROMFILE=vegetation.shp
 CREATEAGNGENBUILD|FROMFILE=building.shp|{00000000-0000-0000-0000-000000000000}
 CREATEAGNLIBOBJ|FROMFILE=libobj.shp|{82be3f0e-40dc-6365-679d-45ac6fde6872}|0|8;8
 #
 WRITEAGNFILES|FS2004|C:\flightsim\work\agn\s43_harvey\texture

Support

If you have any problems while using the program or if you have suggestions and other feedback to improve the tool, please let me know. You can either contact me directly or visit the scenProc subforum at FSDeveloper.com.

User license

(c) 2011 SceneryDesign.org / Arno Gerretsen

This software program is distributed without charge to other addon developers. Redistribution of the original ZIP file is allowed. You are NOT allowed to sell this software program or ask money for its distribution. Special effects created with this software program can be used in commercial scenery projects if you wish.

The copyright and any intellectual property relating to this program remain the property of the author.

The software distributed in this way may represent work in progress, and bears no warranty, either expressed or implied.