Board index FlightGear Development Scenery

Generating Terrain based on OpenStreetMap

Questions and discussion about enhancing and populating the FlightGear world.

Generating Terrain based on OpenStreetMap

Postby D-ECHO » Mon Sep 04, 2017 9:17 am

Good day everybody,
as you may or may not have noticed, I've recently generated some new terrain e.g. for the Caribbean (for those interested, here are the repositorys: https://github.com/D-ECHO/WindwardSouth, https://github.com/D-ECHO/Lucia_and_Martinique, https://github.com/D-ECHO/GDAB, the data is at https://github.com/D-ECHO/WWS_data, https://github.com/D-ECHO/SLaM_data, https://github.com/D-ECHO/GDAB-data).
Those custom sceneries are based (in terms of shapefiles) entirely on the data coming from openstreetmap.org so that's why I'd like to write down and post my typical workflow for this here.

This short write-up describes how to gather tg-ready shapefiles and requires basic QGIS knowledge. Please note that QGIS menu items may not be correctly labelled here as I translate from the german version of QGIS.

1. Obtain the data
At the beginning, I get the data either from http://www.openstreetmap.org/export or, if this is not possible due to to high data size, via Vector->OpenStreetMap->Download Data in QGIS. This data should be safed to a folder like "/data/shapefiles/osm_source" in your Scenery development directory. After downloading, add the data to QGIS via Layer->Add Layer->Add Vector Layer and select the file *.osm you previously safed. After this there should be a window which lets you select what data parts to import, for the beginning, you'll only need "MultiPolygon".

2. Pre-process OSM data
When importing .osm data, QGIS won't allow you to edit it, so first of all, you'll need to convert it to .shp, which is done by right-clicking on the layer "Save Layer As" and saving it to your osm_source folder, I usually use a name like "osm.shp". In the save window, tick "Add safed file to map", so you'll get a new layer with your converted OSM data.

3. Splitting the OSM data
At this step, we will split the one layer into multiple layers for landmass, industrial, forest etc.
Therefor, get into QGIS' edit mode and open the attribut table. Select the corresponding entries and copy them to freshly created layer (via Layer->Create Layer->Create Shapefile->Tick "Polygon"!!) which I usually save according to the TG naming scheme "/data/shapefiles/osm_landmass", "data/shapefiles/osm_industrial" etc.
Here is an OSM-to-TG table when using the attribute table
OSM TG
place=islet
place=island
natural=coastline
-> osm_landmass
landuse=residential ->osm_town *See the "Note About Residential Areas" at the end of the post
leisure=golfcourse ->osm_golfcourse
natural=wood ->osm_forest *will probably be RainForest, MixedForest or EvergreenForest depending on the area you're working on
natural=water ->osm_lake
landuse=industrial ->osm_industrial
natural=beach ->osm_sand
natural=grass ->osm_grassland *if not also leisure=golfcourse

*The OSM wiki is very helpful here, if you have an object in your layer with an attribute you don't know, just search it there. Also, the list above is incomplete, as it only includes the attributes I often encounter, for a complete list of natural=* e.g. look here: http://wiki.openstreetmap.org/wiki/Key:natural most of the classifications are pretty obvious, here is a list of the definitions terragear understands: https://github.com/FlightGear/terragear ... rities.txt

*A Note About Residential Areas*
This is one of the backdraws I encountered during discovering how well OSM is usable for scenery generation: e.g. in the Caribbean there are only very few towns defined, while almost all houses are defined, there are no objects including them, so I had to draw those manually with the OSM data as a background layer.

*Scripting*
I'm pretty sure this whole approach is pretty fast scriptable, so that the OSM file is automatically split into the correct folders when supplying a list. Maybe there are also QGIS tools which can draw automatically town objects around the house objects (which are btw sometimes marked as landuse=residential what means you'll think you have many towns but you only have some houses) with a bit of a margin.

Regards
D-ECHO
D-ECHO
 
Posts: 2462
Joined: Sat May 09, 2015 1:31 pm
Pronouns: Bea (she/her)
Version: next

Re: Generating Terrain based on OpenStreetMap

Postby vanosten » Mon Sep 04, 2017 4:59 pm

Just three questions/remarks:
  • I guess you are still using the usual digital elevation model data - and not OSM, right?
  • Does the coast line work out fine using OSM-data - or did you combine it with the standard scenery coast line?
  • I have code in osm2city to generate land-use borders from buildings - so that could be used. Actually I have a bit better code in another project to solve that problem. Missing land-use data when there are detailed buildings seems to be a common problem in OSM - also e.g. in Switzerland.
Maintaining osm2city. Contributing with ground attack stuff to the OPRF FlightGear military-simulation community.
vanosten
 
Posts: 542
Joined: Sat Sep 25, 2010 6:38 pm
Location: Denmark - but I am Swiss
Pronouns: he/his
Callsign: HB-VANO
Version: latest
OS: Win 10 and Ubuntu

Re: Generating Terrain based on OpenStreetMap

Postby D-ECHO » Mon Sep 04, 2017 5:01 pm

-Yes, still using the SRTM
-Coastline works perfect using OSM-data
-That sound really good :D
D-ECHO
 
Posts: 2462
Joined: Sat May 09, 2015 1:31 pm
Pronouns: Bea (she/her)
Version: next

Re: Generating Terrain based on OpenStreetMap

Postby f-ojac » Wed Sep 06, 2017 6:16 pm

Thanks for the detailed info!
f-ojac
 
Posts: 1304
Joined: Fri Mar 07, 2008 10:50 am
Version: GIT
OS: GNU/Linux

Re: Generating Terrain based on OpenStreetMap

Postby D-ECHO » Thu Sep 07, 2017 6:36 am

You're very welcome :D
D-ECHO
 
Posts: 2462
Joined: Sat May 09, 2015 1:31 pm
Pronouns: Bea (she/her)
Version: next


Return to Scenery

Who is online

Users browsing this forum: No registered users and 8 guests