Variation of vegetation with altitude

  • Most of my flying in AFS2 is soaring with the ASG29 in mountainous areas, therefore I often find myself flying close to the trees on the mountainside.


    scenProc is a fabulous tool for cultivating large ares (thanks Arno), however I do find it annoying that if you want mixed forest on the valley floor you end up with broadleafed trees at 2000m next to a scree slope.


    If only there was a way to get altitude data into scenProc.


    That's when I discovered a great little utility called srtm2osm which will generate contour lines from srtm data in the OSM format.


    srtm2osm can generate very large amounts of data (ie a portion of the Alps can produce a 1.5 Gb OSM file).

    Files that large are unwieldy to edit and contain too many nodes for scenProc to process.


    My approach is to provide a bounding box to srtm2osm that matches the scenery tile I am cultivating.


    The first image shows the raw contours generated by srtm2osm.




    It is obvious there are data glitches in the srtm data that must be cleaned up.

    I wrote a Powershell script that runs srtm2osm for the bounding box and does a first pass at removing extraneous contours such as contours above 2000m which are irrelevant for distinguishing tree species, and small contours that represent data glitches rather than a real elevation gradient.

    The script also adds a bounding box way and some additional tags to aid in OSM editing and scenProc configuration.





    After running the script there is some manual cleanup with an OSM editor (I use JOSM)

    Small jagged contours are an indicator of bogus contours around bad data.

    If you select and delete one of these and there is another contour right underneath that is indicative of bogus data and they can all be deleted.

    If there are no underlying contours it is your choice at that point if you want to undelete the last contour.

    Small contours will not add much to the end result and can be deleted.


    With bogus contours removed the next step is to close the contour polygons. Find all ways (ctrl F) with the lowest elevation (ie ele="500" or height="MidFoothills" in my example script.)

    Draw a new way joining the lowest contour segments head to tail to enclose the upper level contours. The contours obey the right hand rule.

    It helps to have the satellite imagry loaded behind the contours to sort out complicated terain. JOSM will shade the inside border of polygons when they are closed

    Use shift + select to multi-select way segements and join via Tools>Combine Ways if they do not automatically merge.


    Then repeat for the the higher altitude contours. If your cultivation area spans a valley you will have 2 groups of nested contours.





    Once you have cleaned and closed contour polygons the next step is to get scenProc to make use of this data.


    Add an ImportOGR command to load the vegetation zones OSM file

    In your spc after you have placed points in landuse="forest" polygons add the following


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

    ##

    ## Create AF2 plants

    ##

    ## stunted conifers in Sub Alpine Zone

    AddAttributeIfInside|FTYPE="POINT" And landuse="forest"|height="SubAlpine"|String;SubAlpineZone|yes

    CreateAF2Plant|SubAlpineZone="yes"|1;2|0|conifer

    UnloadFeatures|SubAlpineZone="yes"


    ## Upper Montane Zone 100% conifer

    AddAttributeIfInside|FTYPE="POINT" And landuse="forest"|height="MidMontane"|String;UpperMontaneZone|yes

    CreateAF2Plant|UpperMontaneZone="yes"|3;6|0|conifer

    UnloadFeatures|UpperMontaneZone="yes"


    ## Lower Montane Zone 80% conifer

    AddAttributeIfInside|FTYPE="POINT" And landuse="forest"|height="LowerMontane"|String;LowerMontaneZone|yes

    CreateAF2Plant|LowerMontaneZone="yes" And FRAND <= 0.8|5;10|0|conifer

    CreateAF2Plant|LowerMontaneZone="yes" And FRAND > 0.8|4;8|0|broadleaf

    UnloadFeatures|LowerMontaneZone="yes"


    ## Upper Foothills Zone50/50 conifer broadleaf

    AddAttributeIfInside|FTYPE="POINT" And landuse="forest"|height="MidFoothill"|String;UpperFoothillsZone|yes

    CreateAF2Plant|UpperFoothillsZone="yes" And FRAND > 0.5|5;10|0|conifer

    CreateAF2Plant|UpperFoothillsZone="yes" And FRAND <= 0.5|4;8|0|broadleaf

    UnloadFeatures|UpperFoothillsZone="yes"


    ## The remaining trees are Lower Foothills Zone 80% broadleaf

    CreateAF2Plant|landuse="forest" And FRAND < 0.2|5;10|0|conifer

    CreateAF2Plant|landuse="forest" And FRAND >= 0.2|4;12|0|broadleaf

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


    With this mechanism you can vary tree species and tree height to more accurately reflect the natural vegetation at altitude.

    I picked the altitude and zone definitions to roughly match the south face of the central Alps from the wiki, your mountains may differ.


    It does take some effort to process the elevation data but I think it adds a lot to the realism.


    cheers

    /Stu



    srtm2osm_and_cleanup.ps1.txt

    i7-6700K CPU @ 4.00GHz | ASUS Z170-A | 16Gb DDR4 | Samsung SSD 950 PRO NVME M.2 256GB | Samsung SSD 850 EVO 1TB | GeForce GTX 1080 Ti on GP102-A GPU | Oculus CV1 | Windows 10