A QGIS plugin that adds import/export functions for openScope airports. This plugin automates the methods detailed in the openScope documentation Terrain Generation.
Table of contents generated with markdown-toc
This plugin is in development, and cannot be assumed to be reliable. Use at your own peril!. Always open a blank project before running any of the functions as it will remove any existing layers from the canvas.
I'm not a Python developer, so please be aware that some of the code may make your eyes bleed.
- Import geographical features from an openScope airport into a QGIS project.
- Automatically downloads elevation data and generates contours
- Imports shorelines and lakes from the NOAA GSHHG to generate water polygons
- Generates Airspace, Fix, Map JSON from the project
- Generates GeoJSON terrain files for the airport
- Generates Restricted airspace JSON
- Tools for generating circles and extended runway centrelines
Planned features:
- Exporting selected Fixes
- RNAV Fix generation
See the Releases Page for the Change Log.
- QGIS 3.4 Lower versions of QGIS 3.x may work, haven't been tried. It's advisable to use the Long term release (LTR) of QGIS (v.3.4) as likely to be the most stable version
The NOAA GSHHG shapefiles. The current (v.2.3.7) version can be downloaded hereThe NOAA GSHHG shapefiles are now downloaded automatically.
The plugin can be installed in two ways:
- Clone this repository and install it from the CLI
- Download the plugin zip file from releases and install from the QGIS Plugin Manager See Installing and using the QgsOpenScope plugin for QGIS
These instructions are for Ubuntu Linux, modify accordingly depending on your distro of choice.
If you don't have QGIS installed, you can use instructions provided. The plugin has been developed on 3.4 Madeira (LTR). Add the following file to /etc/apt/sources.list.d/
. eg. for Ubuntu 18.03 (Bionic Beaver):
# /etc/apt/sources.list.d/qgis.list
deb https://qgis.org/ubuntu-ltr bionic main
deb-src https://qgis.org/ubuntu-ltr bionic main
Update the packages and install
# Add the key, as provided by the QGIS instructions
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key <KEY>
# Update the packages
sudo apt-get update
# Install the required packages
sudo apt-get install qgis
Install prerequisites
sudo apt-get install git python3-pip python3-setuptools pyqt5-dev-tools
python3 -m pip install wheel pb_tool
Make sure ~/.local/bin
is in your PATH variable, as that is where pb_tool is located
export PATH=$PATH:~/.local/bin
Enter the plugin directory and deploy.
# Deploy expects the plugins directory to exist, so the first time
mkdir -p ~/.local/share/QGIS/QGIS3/profiles/default/python/plugins
pb_tool deploy
It's advisable to install the experimental QGIS Plugin Reloader plugin. This will enable you to reload the plugin without restarting QGIS if when things go wrong.
Some simple unit tests are available, and can be run using the following command in the project root:
python3 -m unittest discover -t ./
The plugin must be installed manually as it has not been published in the QGIS plugin repository. See also the YouTube video - Installing and using the QgsOpenScope plugin for QGIS
- Download the QgsOpenScope plugin from the GitGub website
- Open QGIS and navigate to
Plugins->Manage and install plugins...
- Select
Install from ZIP file
, and select the ZIP file you just downloaded
This step is no longer needed as the plugin automatically downloads the NOAA GSHHG shapefiles.
The YouTube video Installing and using the QgsOpenScope plugin for QGIS demonstrates how to install, configure and use the plugin.
- Navigate to
Plugins->QgsOpenScope->QgsOpenScope Settings
- Specify the path to the openScope airport JSON files, this isn't strictly necessary but makes things quicker to load airports
- Optionally update the path that is used for storing temp files, this should default to the OS default
Navigate to Plugins->QgsOpenScope->Load Airport
, select the airport you want to load. The dialog will display which items will be imported. Items in red indicate that an existing layer will be overwritten. The following items can be imported:
- Fixes
- Restricted
- Maps
- One layer for every MapModel in the
maps
property
- One layer for every MapModel in the
- Terrain
- Existing Terrain (if found)
- Airspace
- Airspace (Hidden) (taken from the
_airspace
property)
Terrain generation is as simple, albeit slower as the plugin will need to download the height files, and more processing time is required.
- Select a polygon that will represents the bounds of the terrain. This will usually be the largest (or only polygon) in the Airspace layer
- Navigate to
Plugins->QgsOpenScope->Generate Terrain
, and select the airport file (this should be the file you last opened) - Wait... this can take some time as it's a CPU intensive process
- Two more layers should be added to the Terrain group:
- Water
- Contours - Final
In some cases (KSFO, KSEA for example), the video map will already have coastline data. Rather than modifying the video maps, the water polygons are required to be modified to coincided with the video map. This uses two QGIS functions:
- The Reshape Feature
- Clipping, including the the Automatic Tracing tool
The tools aren't the most intuitive to use, so it's worth reading the QGIS documentation in the links above. The YouTube video Reshaping water polygons to match the video map demonstrates how this can be done:
- Select the layer you want to edit (this will most likely be the
Water
layer) - Enable editing of the layer (either from the Toolbar, or from the Layer context menu)
- Select the
Reshape Features
tool from theAdvanced Digitizing Toolbar
Enable Snapping
(KeyboardS
) from theSnapping Toolbar
- Optionally
Enable Snapping on Intersection
from theSnapping Toolbar
- Optionally
Enable Tracing
(KeyboardT
) from theSnapping Toolbar
Note: It's advisable to reshape the polygon in shorter segments, this avoids some frustration if the tool fails to work as expected
The key part of using the shaping tools is that "For it to work, the reshape tool’s line must cross the polygon’s boundary at least twice." eg. The start and end points should be on the opposite side of the polygon edge that the line you want to reshape to is on.
It gets very tedious having to click on every vertex. This is where the Tracing
tool is helpful. Instead of having to click on every point, you simply have to enable it (Keyboard T
) and then click on a vertex along the line. Some notes on using the tool:
- Avoid tracing long segments
- When tracing, hide the all layers other than the one you are tracing. The reduces the change of the tool getting "lost"
As well as automatic loading of features and terrain generation, the plugin also has the following features. The YouTube video Installing and using the QgsOpenScope plugin for QGIS demonstrates how to use these tools.
- Circle generation
- Extended runway centreline generation
- Exporting of Fixes, Restricted Airspace, Airspace, Maps, Terrain
Symptom - In QGIS 3.4 on Windows, you get the following message:
Unable to execute the algorithm Could not load source layer for INPUT: ...Elevation - Merged.tif not found
Cause - The gdal_merge script cannot be found, due to a bug in QGIS 3.4 - Some GDAL Functions not working via QGIS interface 3.4.14 Win10 #33386
Solution - As described by @agiudiceandrea here and here, the PYTHONPATH
isn't properly set.
It seems the PYTHONPATH environmental variable is not properly set. It should be set to the path of the folder where there is gdal_polygonize.py (and the other gdal_*.py python scripts): on Windows with a standalone QGIS 3.4 installation it could be e.g. C:\PROGRA\~1\QGIS3\~1.4\apps\Python37\Scripts
- Search your system for the location of the gdal_*.py scripts
- Open the QGIS System Settings:
Settings Menu -> Options -> System Tab
- Check for an existing
PYTHONPATH
system environmental variable at the bottom of the page - Add a new
Custom Variable
, calledPYTHONPATH
using the path from step 1 as the value. If there is an existingPYTHONPATH
system environmental variable, useAppend
, otherwise useOverwrite
. - Restart QGIS