SkyDrop
SkyDrop copied to clipboard
Support XContest Airspace format (OpenAir)
http://airspace.xcontest.org is providing the daily airspace data relevant for paragliding and hanggliding. This is the best and most actual source of airspace data, because in addition to the OpenAIP data it also contains (specific to switzerland) the 5km/2.5km cylinders of airfields/helicopter fields with 600mAGL, all local airfield agreements, and all the daily updated resticted areas (e.g. military flying..).
The data can be exported from airspace.xcontest.org in OpenAir or XCTracer format.
Unfortunately, I couldn't find a way to convert the OpenAir file to OpenAIP to get it to my SkyDrop.
So it would be great to support OpenAir format or provide some converter to be able to get the data from xcontest to the SkyDrop.
As a nice side effect of that, it would then also be possible to get the obstacle data for switzerland, austria and italy which is available under http://www.skyride.ch/en/hindernisdaten/?noredirect=en_US
I would like to see this feature added too. Any progress on finding a way to convert files. What format does SkyDrop use? I could probably write a converter or even add support.
The code that reads the .AIR files is here: https://github.com/fhorinek/SkyDrop/blob/master/skydrop/src/fc/airspace.cpp
It described the format. It's basically a 3D array of points in space with their airspace classification. The Skydrop opens the relevant file then reads in the data for the current position.
The OpenAir format is described here: http://www.winpilot.com/UsersGuide/UserAirspace.asp
I wrote the first implementation for airspaces. You can find the scripts to generate the AIR files here: https://github.com/fhorinek/SkyDrop/tree/master/skydrop/utils/airspace. Older version (to be found in git history) are able to read Open-Airspace format. Maybe the following converter can help as well: https://alus-it.github.io/AirspaceConverter/
@bubeck That's very helpful. So which format do the tools read now and how do you run them? The page you link says I can convert an OpenAir file with python3 ./convert.py Germany_CW17_2018.txt
. Is this still true or has the Skydrop format changed since this tool was made?
Unfortunately, the AIR file format changed between the versions. All documentation that you find there is written for the old AIR file format, as well as all examples. They all belong to "version 1". After that, fero changed the script, the AIR file format and also the input format (but not the documentation).
So, probably the best way would be to "revert" the script to the old OpenAIR parser but keep the outut handler identical to the new AIR format. However, this will be some work, but its doable.
If you have a working implementation, we can merge it to the repository and also update the documentation to make it easier for users to generate for their own use. I am willing to help.
very complicated story - why not just provide the newest data of airspace or provide a converter. Skydrop can't be used as an airspace warning, since the data provided by skydrop is old.
I created for myself a small script that :
- Convert an OpenAIR file to an OpenAIP one using XC global (https://xcglobe.com/airspace)
- Map some airspace categories
- Call the existing Python script to generate the AIR files
You can create this script in .../SkyDrop/tree/master/skydrop/utils/airspace/convert_openair.sh
.
#!/bin/bash
openair_file=$1
curl -s --request POST \
--url https://xcglobe.com/airspace/upload-file \
--header 'Content-Type: multipart/form-data' \
--form file="@$openair_file" > /dev/null
uploaded_openair_file=$(basename "$openair_file")
exported_aip_file=source/export.aip
curl -s --request POST \
--url https://xcglobe.com/airspace/export-file \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data sourceType=openair \
--data sourceName="$uploaded_openair_file" \
--data destType=aip \
--data saveto=disk \
--data _noAjaxSubmit= \
--data 'airsJson=[]' | \
sed 's/CATEGORY="R"/CATEGORY="RESTRICTED"/g' | \
sed 's/CATEGORY="Q"/CATEGORY="DANGER"/g' | \
sed 's/CATEGORY="P"/CATEGORY="PROHIBITED"/g' | \
sed 's/CATEGORY="GP"/CATEGORY="PROHIBITED"/g' | \
sed 's/CATEGORY="W"/CATEGORY="WAVE"/g' > "$exported_aip_file"
rm -r data 2> /dev/null
python3 convert.py $exported_aip_file
Usage :
$ ./convert_openair.sh ~/Download/export.txt
The AIR files will be generated in the .../SkyDrop/tree/master/skydrop/utils/airspace/data
folder.
Remarks : Works well with the Swiss airspaces got in https://airspace.xcontest.org/. You even get the airfields and the local agreements. Regarding the obstacles, I don't recommend to export them because one AIR file can have at most 125 airspaces defined and in Valais for instance, we clearly have more than that.