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.vrt
Load into canvas when finished
OK
Note: 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 Delimiters
Geometry Definition
check Well Known Text (WKT)
Click OK
Vector->Geometry Tools->Polygons to Lines...
airspace
Run
Lines from polygons
to perimeter
Vector->Geoprocessing Tools->Fixed distance buffer
airspace
0.005
Click Run
Processing->Toolbox
Clip raster by mask layer
dem
Buffer
Run
Note: 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 Lines
Buffer
Click Run
Lines from Polygons
layer to clipping
Buffer
layerRaster->Extraction->Contour...
Clipped (mask)
~/terrain/contours.shp/
304.8
(1000ft in meters)OK
Note: After it completes, click OK
on the popups and Close
on the Contour window.
Vector->Geometry Tools->Simplify geometries
contours
0.002
Click Run
contours
layerSimplified
layer to contours
Vector->Data Management Tools->Merge Vector Layers
perimeter
& contours
Click Run
Polygonize
toolMerged
Click Run
Vector->Geoprocessing Tools->Clip
Polygons from Lines
airspace
Click Run
Polygons from Lines
layerVector->Geoprocessing tools->Eliminate Sliver Polygons
Clipped
area
(Note: May require changing input layer to airspace
and back to Clipped
)<=
0.00005
Largest common boundary
Run
*Note: This step can sometimes take a while to complete.
Raster->Zonal statistics->Zonal statistics
Clipped (mask)
Cleaned
mean
Click OK
Cleaned
layerLayer->Toggle Editing
View->Select->Select by Expression...
"mean" < 304.8
Select
Close
Go to Edit->Delete selected
Field Calculator
(Button with an Abacus at the top of the screen)Create virtual field
elevation
Decimal number (real)
floor("mean" / 304.8) * 304.8
Click OK
Layer->Save Layer Edits
Layer->Toggle Editing
Layer->Save As...
GeoJSON
~/terrain/icao.geojson/
where icao
is the ICAO code of your airport, e.g. KSEA.geojson
EPSG:4326, WGS 84
elevation
10
Click OK
Project->Save As...
~/terrain/icao.qgs/
where icao
is the ICAO code of your airport, e.g. KSEA.qgs
DEM
folder from ~/terrain/
Upload Files
~/terrain/
folder into the page.Commit directly to the master branch
Click Commit changes
~/terrain/icao.geojson
file into ~/openscope/assets/airports/terrain/
has_terrain
is set to true
If 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 Layer
Selected Features Only
boxNumber of Rings
should be 1.Distance between Rings
box.Modify Attributes
tool to ensure each polygon’s elevation
attributes is 0
Merge Selected Features
tool to merge any water polygons that intersect.Reshape Features
tool to remove any segments that are outside the airspace.