Table of contents generated with markdown-toc
This guide will show you how to generate a terrain file for any airport in openScope. This is mainly done using QGIS, a free and open source Geographic Information System. The process can be quite tedious and often frustrating, so if you get stuck somewhere, you can talk to us on Slack, where we will be happy to help you!
Download and install QGIS from the QGIS website
Note: QGIS version 3 is not compatible with the Zonal Statistics plugin.
Plugins->Manage and install plugins...Zonal statistics plugin and enable plugin~/KSEA/
Note: Throughout this guide it will be referred to as ~/terrain/~/terrain/DEM/~/terrain/airspace.csv/Raster->Miscellaneous->Build Virtual Raster(Catalog)...Choose input directory instead of files~/terrain/DEM/Recurse subdirectories~/terrain/dem.vrtLoad into canvas when finishedOKNote: After it completes, click OK on the popups and Close on the Build Virtual Raster window.
Layer->Add Layer->Add Delimited Text Layer...File Name browse ~/terrain/airspace.csv/File Format check Custom DelimitersGeometry Definition check Well Known Text (WKT)Click OK
Vector->Geometry Tools->Polygons to Lines...airspaceRunLines from polygons to perimeterVector->Geoprocessing Tools->Fixed distance bufferairspace0.005Click Run
Processing->ToolboxClip raster by mask layerdemBufferRunNote: QGIS may seem frozen while the algorithm is run, but it is still running. Try not clicking anywhere on the program to ensure it does not crash.
Vector->Geometry Tools->Polygons to LinesBufferClick Run
Lines from Polygons layer to clippingBuffer layerRaster->Extraction->Contour...Clipped (mask)~/terrain/contours.shp/304.8 (1000ft in meters)OKNote: After it completes, click OK on the popups and Close on the Contour window.
Vector->Geometry Tools->Simplify geometriescontours0.002Click Run
contours layerSimplified layer to contoursVector->Data Management Tools->Merge Vector Layersperimeter & contoursClick Run
Polygonize toolMergedClick Run
Vector->Geoprocessing Tools->ClipPolygons from LinesairspaceClick Run
Polygons from Lines layerVector->Geoprocessing tools->Eliminate Sliver PolygonsClippedarea (Note: May require changing input layer to airspace and back to Clipped)<=0.00005Largest common boundaryRun*Note: This step can sometimes take a while to complete.
Raster->Zonal statistics->Zonal statisticsClipped (mask)CleanedmeanClick OK
Cleaned layerLayer->Toggle EditingView->Select->Select by Expression..."mean" < 304.8SelectCloseGo to Edit->Delete selected
Field Calculator (Button with an Abacus at the top of the screen)Create virtual fieldelevationDecimal number (real)floor("mean" / 304.8) * 304.8Click OK
Layer->Save Layer EditsLayer->Toggle EditingLayer->Save As...GeoJSON~/terrain/icao.geojson/ where icao is the ICAO code of your airport, e.g. KSEA.geojsonEPSG:4326, WGS 84elevation10Click OK
Project->Save As...~/terrain/icao.qgs/ where icao is the ICAO code of your airport, e.g. KSEA.qgsDEM folder from ~/terrain/Upload Files~/terrain/ folder into the page.Commit directly to the master branchClick Commit changes
~/terrain/icao.geojson file into ~/openscope/assets/airports/terrain/has_terrain is set to trueIf you’ve made it this far, you have successfully generated a terrain file for openScope. Give yourself a break now, you deserve it!
If you’re having any problems while following this guide, you can talk to us on Slack, where we will be happy to help you!
Using QGIS 3.4 and above, there is now a plugin - qgsopenscope that:
Intructions on how to install and use the plugin are located in the repository, as well as some videos (no audio, but subtitled) on YouTube that demonstrate the usage:
The GSHHG database only contains coastlines and lakes. In order to generate river polygons, the lines can be imported from the CIA World DataBank II (Rivers and Political Boundaries). If you’ve already downloaded the shapefiles required by the qgsopenscope plugin, then you will have these files. Otherwise, downloaded the shapefile archive, and unpack it.
There are a few ways of loading the existing terrain:
Note: Ensure the project CRS is WGS84 (EPSG: 4326)
This is a relatively arbitrary process and you will have to decide which rivers to include. The CIA World DataBank II (WDBII) databases contains 11 levels of waterways. Levels 1, 2 and 3 should be sufficient. The levels we’re mainly interested in are:
The “fine” data should be of a sufficient quality, so add the following layers into QGIS:
Ctrl+Alt+V) and call it “Rivers”Merge Selected Features tool.Simplify Features tool, set the tolerance to 0.0005 and select Map Units.Open the Processing Toolbox (Ctrl+Alt+T), and then for each river:
Measure Line tool (Ctrl+Shift+M) to measure the width agains the OpenStreeMap layer, using the units as degrees.Vector Geometry -> Multi-ring Buffer toolInput LayerSelected Features Only boxNumber of Rings should be 1.Distance between Rings box.Modify Attributes tool to ensure each polygon’s elevation attributes is 0Merge Selected Features tool to merge any water polygons that intersect.Reshape Features tool to remove any segments that are outside the airspace.