OpenStreetMaps, ScenProc, building floors and Cultivation

  • Has anyone figured out how to import building:levels using ScenProc and OSM?

    Or to use ScenProc to detect trees with AeroScenery stitched images?

  • Has anyone figured out how to import building:levels using ScenProc and OSM?

    There's no building height indication in OSM, there's some guesswork to be done when setting up your ScenProc steps.

    Hint: AFS2 buildings tend to be too big. Better reduce somewhat the number of floors compared to what you'd guess.

    Cheers

    Antoine

    Config : i7 6900K - 20MB currently set at 3.20GHz, Cooling Noctua NH-U14S, Motherboard ASUS Rampage V Extreme U3.1, RAM HyperX Savage Black Edition 16GB DDR4 3000 MHz, Graphic Card Gigabyte GeForce GTX 1080 8GB, Power supply Corsair RM Series 850W, Windows 10 64 bit.

  • I havent't tried it yet, but I think there's no computing ability in ScenProc steps.

    Anyway, numFloor should be an integer.

    Technically, 3m per floor should be a good thumb rule, but I found out the resulting cultivation buildings were too big, thus I changed for 4m per floor instead for a start. Still to be optimized though.

    When there's a height information, I use brackets :

    Code
    CreateAF2Building|Building="*" And (whatever) And height < 4|1|gable|residential
    CreateAF2Building|Building="*" And (whatever) And height >= 4 And height < 8|2|gable|residential
    CreateAF2Building|Building="*" And (whatever) And height >= 8 And height < 12|3|gable|residential
    etc.


    Cheers

    Antoine

    Config : i7 6900K - 20MB currently set at 3.20GHz, Cooling Noctua NH-U14S, Motherboard ASUS Rampage V Extreme U3.1, RAM HyperX Savage Black Edition 16GB DDR4 3000 MHz, Graphic Card Gigabyte GeForce GTX 1080 8GB, Power supply Corsair RM Series 850W, Windows 10 64 bit.

  • building:levels is used in OSM for commercial type buildings indicating the number of floors. Look in downtown Cleveland, Ohio to see and example, near Burke Lakefront Airport.

    ScenProc does support passing the number of floors using an attribute OR an integer according to the documentation

    Help shows "name of the attribute that contains the of the number of floors building. If the attribute doesnt exist, the entered text will be used as the number of floors"

    Edited 2 times, last by pkaser (July 16, 2018 at 3:46 PM).

  • Hi,

    scenProc can indeed not do calculations in the AddAttribute step, only in filters calculations are supported.

    If there is an attribute with the number of floors scenProc can use that. But if some features have that attribute and other not that might also not give the intended results. So in that case the best approach would be to make sure each feature has that attribute, for example by assigning it a default value for the features that don't have the attribute yet.

    Arno

  • I haven't been able to get the building:levels attribute to work in my imports, fyi.

    And thanks Arnog. ScenProc is pretty amazing! I plan on spending more time figuring out how to pull scenery from images this weekend....it's a lot to process in the manual

  • Well, I have been trying and failing to use levels as the attribute to import the building floors. Any help will be much appreciated:

    CreateAF2Building|building="*" And FAREARAT>0.7 And FLENGTH < 14|1|flat|industrial|0

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

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


    <way id="99653003" visible="true" version="4" changeset="52314639" timestamp="2017-09-23T21:05:25Z" user="Edward" uid="364">

    <nd ref="1152120012"/>

    <nd ref="1152120009"/>

    <nd ref="3714106969"/>

    <nd ref="3714106968"/>

    <nd ref="3714106978"/>

    <nd ref="1152120020"/>

    <nd ref="1152120030"/>

    <nd ref="1152120005"/>

    <nd ref="3714106980"/>

    <nd ref="1152120012"/>

    <tag k="addr:state" v="OH"/>

    <tag k="building" v="apartments"/>

    <tag k="floors" v="16"/>

    <tag k="ele" v="202"/>

    <tag k="gnis:county_name" v="Cuyahoga"/>

    <tag k="gnis:feature_id" v="2120897"/>

    <tag k="gnis:import_uuid" v="57871b70-0100-4405-bb30-88b2e001a944"/>

    <tag k="gnis:reviewed" v="no"/>

    <tag k="name" v="Hanna Building"/>

    <tag k="source" v="USGS Geonames"/>

    <tag k="wikidata" v="Q21016001"/>

    </way>

    Holy Shikies! It imports the floors automatically!!!! Im not sure if it was the ini file or not, as it crashed a million times, but when I added 'And levels="*"' it worked

    CreateAF2Building|building="*" And FAREARAT>0.7 And FLENGTH < 14|1|flat|industrial|0

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

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

    And my osmconf.ini in the scenproc\gdal-data directory:

    #

    # Configuration file for OSM import

    #

    # put here the name of keys for ways that are assumed to be polygons if they are closed

    # see http://wiki.openstreetmap.org/wiki/Map_Features

    closed_ways_are_polygons=aeroway,amenity,boundary,building,craft,geological,historic,landuse,leisure,military,natural,office,place,shop,sport,tourism

    # comment to avoid laundering of keys ( ':' turned into '_' )

    attribute_name_laundering=yes

    # uncomment to report all nodes, including the ones without any (significant) tag

    report_all_nodes=yes

    # uncomment to report all ways, including the ones without any (significant) tag

    report_all_ways=yes

    [points]

    # common attributes

    osm_id=yes

    osm_version=no

    osm_timestamp=no

    osm_uid=no

    osm_user=no

    osm_changeset=no

    # keys to report as OGR fields

    attributes=name,barrier,highway,ref,address,is_in,place,man_made,power,amenity,religion,natural,generator:source,leisure

    # keys that, alone, are not significant enough to report a node as a OGR point

    #unsignificant=created_by,converted_by,source,time,ele

    # keys that should NOT be reported in the "other_tags" field

    #ignore=created_by,converted_by,source,time,ele,note,openGeoDB:,fixme,FIXME

    # uncomment to avoid creation of "other_tags" field

    #other_tags=no

    # uncomment to create "all_tags" field. "all_tags" and "other_tags" are exclusive

    #all_tags=yes

    [lines]

    # common attributes

    osm_id=yes

    osm_version=no

    osm_timestamp=no

    osm_uid=no

    osm_user=no

    osm_changeset=no

    # keys to report as OGR fields

    attributes=name,highway,waterway,aerialway,barrier,man_made,power,tunnel,bridge,railway

    # keys that should NOT be reported in the "other_tags" field

    #ignore=created_by,converted_by,source,time,ele,note,openGeoDB:,fixme,FIXME

    # uncomment to avoid creation of "other_tags" field

    #other_tags=no

    # uncomment to create "all_tags" field. "all_tags" and "other_tags" are exclusive

    #all_tags=yes

    [multipolygons]

    # common attributes

    # note: for multipolygons, osm_id=yes instanciates a osm_id field for the id of relations

    # and a osm_way_id field for the id of closed ways. Both fields are exclusively set.

    osm_id=yes

    osm_version=no

    osm_timestamp=no

    osm_uid=no

    osm_user=no

    osm_changeset=no

    # keys to report as OGR fields

    attributes=name,type,aeroway,amenity,admin_level,barrier,boundary,building,craft,geological,historic,land_area,landuse,leisure,man_made,military,natural,office,place,shop,sport,tourism,way,floors,levels

    # keys that should NOT be reported in the "other_tags" field

    #ignore=area,created_by,converted_by,source,time,ele,note,openGeoDB:,fixme,FIXME

    # uncomment to avoid creation of "other_tags" field

    #other_tags=no

    # uncomment to create "all_tags" field. "all_tags" and "other_tags" are exclusive

    #all_tags=yes

    [multilinestrings]

    # common attributes

    osm_id=yes

    osm_version=no

    osm_timestamp=no

    osm_uid=no

    osm_user=no

    osm_changeset=no

    # keys to report as OGR fields

    attributes=name,type,floors,levels

    # keys that should NOT be reported in the "other_tags" field

    #ignore=area,created_by,converted_by,source,time,ele,note,openGeoDB:,fixme,FIXME

    # uncomment to avoid creation of "other_tags" field

    #other_tags=no

    # uncomment to create "all_tags" field. "all_tags" and "other_tags" are exclusive

    #all_tags=yes

    [other_relations]

    # common attributes

    osm_id=yes

    osm_version=no

    osm_timestamp=no

    osm_uid=no

    osm_user=no

    osm_changeset=no

    # keys to report as OGR fields

    attributes=name,type

    # keys that should NOT be reported in the "other_tags" field

    #ignore=area,created_by,converted_by,source,time,ele,note,openGeoDB:,fixme,FIXME

    # uncomment to avoid creation of "other_tags" field

    #other_tags=no

    # uncomment to create "all_tags" field. "all_tags" and "other_tags" are exclusive

    #all_tags=yes

  • Is there a simple way to plant buildings like trees where we could have a folder of 10 tall building objects and then use the OSM data from the downtown area of any city to randomly plant those 10 tall buildings wherever there is an OSM point? Any tall buildings would be better than none.

  • I figured out how to import with ScenProc (latest developer build) building levels tonight....and I posted a how to in this thread, but now it is gone! Also, if levels aren't in the osm file, it won't create the element. I'm doing some experimenting...

    Here is my ScenProc script:


    # 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\mapa.osm|*|*|NOREPROJ

    #

    #

    # 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="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

    #

    # 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

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

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

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

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

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


    #

    # 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"

    #

    #

    # Create AF2 plants

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

    CreateAF2Plant|landuse="forest" And FRAND >= 0.1|8;40|0|broadleaf

    CreateAF2Plant|landuse="forest" And FRAND < 0.1|10;40|0|conifer

    CreateAF2Plant|natural="wood" And FRAND >= 0.1|8;40|0|broadleaf

    CreateAF2Plant|natural="tree_row" And FRAND >= 0.1|8;40|0|broadleaf

    CreateAF2Plant|leisure="park" And FRAND >= 0.1|8;40|0|broadleaf

    CreateAF2Plant|leisure="nature_reserve" And FRAND >= 0.1|8;40|0|conifer

    CreateAF2Plant|natural="tree"|8;25|0|broadleaf

    CreateAF2Plant|landuse="meadow" And FRAND >= 0.4|5;12|0|shrub|plant_type_shrub_T00

    CreateAF2Plant|landuse="meadow" And FRAND >= 0.4|3;8|0|shrub|plant_type_shrub_T01

    # 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

    So now this thing isnt generating plants :(

    This is soooo freaking frustrating.

    Edited 3 times, last by pkaser (August 3, 2018 at 11:55 AM).

  • Hi,

    I have added the levels and floors attributes by default to the osmconfig.ini file now. I the next build that will be included.

    When a feature doesn't have the attribute, the attribute name is parsed as number of floors now. Which will return 0 in case of levels and therefore it probably doesn't show.

    So your extra check in the filter to check if levels has a value is correct. You should probably at a check to the step where you don't use the levels attribute to make sure that there you only catch buildings without the attribute (so add And Not levels="*").

    For the plants issue, I have changed the PlacePointsInPolygon step recently (check the manual). You need to add the optional option INHERITPARENTATTR to make sure the attributes are copied. Else your filter doesn't work. I changed this to make sure all steps that place points work the same. I have also just updated the AF2 sample in the manual to ensure the attribute is in the sample as well.

    Arno

  • Thank you! This Is awesome!

    Is there any way to be able to pass a random number range to it for items that dont have a building level so we could randomize buildings from like 2 floors to 5 in small cities and like 20-40 in larger cities like we do with trees?

  • Arno, could you please also include an example of how to convert the height of a building into floors?

    Often the height is given, but no floor. So the ideal thing would be to take a floor if available, else a height converted into floors and if nothing of these data are available, then a random floor number. It really would be great if you could show us an example.

    Cheers, Thomas


  • 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

  • Downtown Cleveland, Ohio by Burke Lakefront Airport

    Fantastic Arno! I so very much appreciate those changes!