OpenStreetMaps, ScenProc, building floors and Cultivation

  • Here is my latest script for anyone that may want some assistance with this topic. I try not to hoard information, and if my experience can help people save hours of trial and error, I'm glad to help. I left Rodeo's stuff in there that I am not using, in case someone else may want to use that feature to exclude things, etc.

    On a side note to Arno: I am very thankful for helping us by adding features to your product very quickly and adopting FS2 into your amazing product, and just letting us use the tool the way we want and not holding us to a standard that you think we should be creating scenery at. I know this seems weird, but allowing people to just make scenery the way we want, at the level of detail we want, is just very appreciated. I also appreciate your website, where he just lets people throw out ideas, good or bad, and lets the process just happen organically without trying to control product perception, product use outcomes, editing forum posts, deleting forum posts, and such.

    I do a search and replace on the map.osm for "building:levels" and replace it with "levels".

    # AeroFly FS 2 scenProc script

    # with function to filter out objects on airport

    # Author of scenProc Arno Gerretsen

    # Script amended, modified and enhanced by Rodeo

    # --------------------------------------------------------

    #

    # Load OpenStreetMap data of the area to work on

    # Load highway, landuse and building to save memory

    #ImportOGR|d:\construction\KBKL\OSM\map.osm|*|highway;landuse;building|NOREPROJ

    ImportOGR|d:\construction\kbkl\OSM\map.osm|*|*|NOREPROJ

    #

    # Filter out the buldings, lights and plants

    # that are within the exclude polygons

    #AddAttributeIfInside|building="*"|FROMFILE="exclude.kml"|String;skip|yes

    #AddAttributeIfInside|point="light"|FROMFILE="exclude.kml"|String;skip|yes

    #AddAttributeIfInside|FTYPE="POINT" And landuse="forest"|FROMFILE="exclude.kml"|String;skip|yes

    #UnloadFeatures|skip="yes"

    #

    # Plants

    # Place point features for the plants in forest polygons

    # using spacing of 0.00025 degrees and full randomness

    PlacePointsInPolygon|landuse="forest"|0.00025;0.00025|1.0;1.0|INHERITPARENTATTR

    PlacePointsInPolygon|natural="wood"|0.00025;0.00025|1.0;1.0|INHERITPARENTATTR

    PlacePointsInPolygon|natural="tree"|0.00025;0.00025|1.0;1.0|INHERITPARENTATTR

    PlacePointsInPolygon|natural="tree_row"|0.00025;0.00025|1.0;1.0|INHERITPARENTATTR

    PlacePointsInPolygon|leisure="park"|0.00025;0.00025|1.0;1.0|INHERITPARENTATTR

    PlacePointsInPolygon|leisure="nature_reserve"|0.00025;0.00025|1.0;1.0|INHERITPARENTATTR

    #

    #

    # Create AF2 plants

    # CreateAF2Plant|landuse="forest"|10;20|broadleaf

    # Create AF2 plants

    # CreateAF2Plant|landuse="forest"|10;20|broadleaf

    CreateAF2Plant|landuse="forest" And FRAND < 0.5|8;40|0|broadleaf

    CreateAF2Plant|landuse="forest" And FRAND > 0.5|10;40|0|conifer

    CreateAF2Plant|natural="wood" And FRAND < 0.5|8;40|0|broadleaf

    CreateAF2Plant|natural="tree_row" And FRAND < 0.5|8;40|0|broadleaf

    CreateAF2Plant|leisure="park" And FRAND < 0.5|8;40|0|broadleaf

    CreateAF2Plant|leisure="nature_reserve" And FRAND < 0.5|8;40|0|conifer

    CreateAF2Plant|natural="tree" And FRAND < 0.5|8;25|0|broadleaf

    CreateAF2Plant|landuse="meadow" And FRAND < 0.5|5;12|0|shrub|plant_type_shrub_T00

    CreateAF2Plant|landuse="meadow" And FRAND < 0.5|3;8|0|shrub|plant_type_shrub_T01

    #

    #

    # Create AF2 buildings for polygons that are almost rectanguar

    # Make longer buildings industrial with a flat roof

    #CreateAF2Building|building="commercial"|levels|flat|industrial

    CreateAF2Building|building="*" And FAREARAT>0.7 And FLENGTH < 14|2|flat|residential|0

    CreateAF2Building|building="*" And FAREARAT>0.7 And FLENGTH >= 14 And FLENGTH < 28|2|gable|residential|0

    CreateAF2Building|building="*" And FAREARAT>0.7 And FLENGTH >= 28 and levels <> "*"|3|flat|commercial|0

    CreateAF2Building|building="commercial" And FAREARAT>0.7 And FLENGTH >= 28 And levels="*"|levels|flat|commercial|0

    CreateAF2Building|building="apartments" And FAREARAT>0.7 And FLENGTH >= 28 And levels="*"|levels|flat|commercial|0

    CreateAF2Building|building="yes" And FAREARAT>0.7 And FLENGTH >= 28 And levels="*"|levels|flat|commercial|0

    CreateAF2Building|building="retail" And FAREARAT>0.7 And FLENGTH >= 28 And levels="*"|levels|flat|commercial|0

    CreateAF2Building|building="industrial" And FAREARAT>0.7 And FLENGTH >= 28 And levels="*"|levels|flat|industrial|0


    #

    # Load Shapefile that will be excluded from processing

    #ImportOGR|d:\construction\KPCW\OSM\exclude.kml|*|*|NOREPROJ

    #

    # Split the features into a grid of 0.25 x 0.25 degrees

    # Do not split buildings, but filter them into the right grid cells

    # SplitGrid|0.25|*|building="*"

    #

    # Lights

    # Place point features for the lights along roads

    PlacePointsAlongLine|highway="motorway"|SINGLE|45;55|6;6|25|String;point|plight|hdg

    PlacePointsAlongLine|highway="primary"|SINGLE|45;55|6;6|25|String;point|plight|hdg

    PlacePointsAlongLine|highway="secondary"|SINGLE|40;40|4;4|20|String;point|slight|hdg

    PlacePointsAlongLine|highway="tertiary"|SINGLE|30;35|4;4|10|String;point|tlight|hdg

    PlacePointsAlongLine|highway="residential"|SINGLE|30;30|4;4|10|String;point|rlight|hdg

    PlacePointsAlongLine|highway="living_street"|SINGLE|30;30|4;4|10|String;point|rlight|hdg


    # Create AF2 lights

    CreateAF2Light|point="plight"|0.9;0.8;0.7|5|0;0;1|10

    CreateAF2Light|point="slight"|0.9;0.7;0.5|3|0;0;1|8

    CreateAF2Light|point="tlight"|0.6;0.6;0.7|3|0;0;1|6

    CreateAF2Light|point="rlight"|0.9;0.6;0.3|3|0;0;1|6


    #

    # Export the AF2 TOC file

    ExportTOC|d:\construction\kbkl\OSM|map

  • Hi arnog

    I've been using the detection features of ScenProc very often to create vegetation for specific areas. As I understand something changed in the latest development release (like the need to use 4 to 5 arguments for "CreateAFS2Plant", the modified PlacePointsInPolygon line script to add the INHERITPARENTATTR command, etc.), but for some reason all that is not working for me (is not generating any vegetation).

    This is the script I'm currently using (after "#" is the very original line of the script, the way I used to do before the latest release):

    ImportOGR|C:\Scenery for Aerofly FS 2\Scenery\construction\corse_france\figari_sudcorse_lfkf\cultivation_bonifacio\data\bonifacio_plants_01.shp|*|*|AUTODETECT

    #PlacePointsInPolygon|*|0.00010;0.00010|1.0;1.0

    PlacePointsInPolygon|landuse="forest"|0.00010;0.00010|1.0;1.0|INHERITPARENTATTR

    #CreateAF2Plant|FRAND >= 0.5|8;20|broadleaf

    CreateAF2Plant|landuse="forest" And FRAND >= 0.5|8;20|0|broadleaf

    CreateAF2Plant|landuse="forest" And FRAND < 0.5|5;15|0|shrub

    #CreateAF2Plant|landuse="forest" And FRAND >= 0.4|6;16|0|palm

    ExportTOC|C:\Scenery for Aerofly FS 2\Scenery\construction\corse_france\figari_sudcorse_lfkf\cultivation_bonifacio\|bonifacio_plants_01

    With this script I don't even get a TOC file at the end of the process. As always, this script is used after getting the BMP, selecting the vegetation areas and generating the SHP file (in this case bonifacio_plants_01.shp).

    Any help is much appreciated.

    Cheers, Ed

  • Hi Ed,

    Do your detected vegetation areas have an attribute landuse="forest"? Else no plants will be made. When there are no features to export no TOC file is made either.

    The log of running the script should tell you if features were processed or not.

    Arno

  • Hi Ed,

    Do your detected vegetation areas have an attribute landuse="forest"? Else no plants will be made. When there are no features to export no TOC file is made either.

    The log of running the script should tell you if features were processed or not.

    Ok, thanks. I've got it working now. I was simply not using any attribute, so I deleted landuse="forest" from the respective lines.

    I have one more question, though: what's the meaning and purpose of the argument "0" (zero) before the vegetation type broadleaf/shrub, etc.?. I was not using it before the latest development release, but now seems that a number there is necessary.

    Cheers, Ed

  • Hi all,

    I have just finished another update of the CreateAF2Building step so that it can use both levels and height attributes. The manual contains a script on how to use this. It will be in the next development release that should be online in a few hours from now.

    Arno

  • Hi Ed,

    That additional argument is the altitude at which the plant is placed. This allow you to place it at a different altitude than ground level if you wish. But in most cases 0 should be fine.

    Hi Arno:

    Thanks so much.

    Please re-check the script posted in section 9.5.3 of the ScenProc manual (Create AF2 Plant). It seems that the location of the altitude argument should be before "broadleaf", and not at the end of the line, as follows:

    CreateAF2Plant|landuse="forest" And FRAND >= 0.5|10;20|0|broadleaf

    I experimented placing it at the end, and the results were not as intended.

    Thanks again, Ed

  • If you rename building:levels to levels you must modify the /gdal-data/osmconf.ini and add "levels" to the end of the line that has "building:levels"

  • Tom, at the moment the only way to convert between height and floors would be to include it in the filter. So let's see you have multiple steps for 1, 2 and 3 floors. In the filter to select the features you would then include something like "height > 0 And height < 3" for 1 floor, "height > 3 And height < 6" for 2 floors, etc.


    In the filter you could also check for height != "*" to select features that don't have the attribute. These could use random values.


    I'll try to make a sample script later.

    Maybe I can let the CreateAF2Building step handle both height and floors. I need to think about that.

    Arno, would you post a sample script that generates tall buildings of random height for a small downtown area that does not have building height or floors info in the OSM data?

  • PK, did you try building_levels !="*" or are you using the earlier approach of doing the find & replace on building:levels to just levels?

    My scripts over the weekend seemed to work with the "building_levels" term - I think either Arno or someone else mentioned in the latest ScenProc version that it converts building:levels to building_levels .

  • I did a s and r on building:levels to levels. Missed that update from Arno. Couldn't get building:levels to ever work. I cant != to work. Only <>"*"