Skip to content

Scripts to convert the OpenAir format to a JSON Format

License

Notifications You must be signed in to change notification settings

TWCurry/OAir-2-JSON

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OAir-2-JSON

A script to transfer the OpenAir airspace data format into JSON, for use in websites, APIs, anything it may be useful for really.

The main library is contained within OAir2json.py, but there is a wrapper script (main.py) supplied to allow being run manually.

For Python 3.7+

Usage

Wrapper Script

py main.py fileLoc outputLoc

Parameters

  • fileLoc: Location of Open Airspace formatted file. Can be either a URL or path
  • outputLoc: Location of file to output

Library Function

Simply import the OAir2Json function, then call it. Pass the input OpenAir formatted text as a string, and the function will return the json (formatted as a python dict).

Supported Syntax

Unfortunately, OpenAir appears to have no proper standardisation for formats, which makes it pretty difficult to support all possible OpenAir formatted files, since there are so many variations. Overall, they follow a similar structure. Below is the syntax that is supported, this is mostly based of the definition of the OpenAir format at http://www.winpilot.com/UsersGuide/UserAirspace.asp.

  • AC class
  • AN airspaceName
  • AH airspaceCeiling
  • AL airspaceFloor
  • V x=n Variable assignment:
    • D=+/- (sets direction of next arc)
    • X=coordinate (sets the centre of an arc)
  • DP coordinate (polygon point)
  • DB coordinate1 coordinate2 (arc between 2 points)
  • DC radius circle

Output syntax

{
    "introText": "Comments at the beginning of the file",
    "sectors": [
        {
            "asType": "A/C/D/E/G/MATZ/ATZ/...",
            "asName": "FICTIONAL ATZ",
            "altMin": "FL05/5000ALT",
            "altMax": "FL06/6000ALT",
            "points": [
                ["lat", "lon"],
                ["lat", "lon"]
                ...
            ],
            "arcs": [
                {
                    "centre": ["lat", "lon"],
                    "arcDir": "clockwise/counterclockwise",
                    "radius": 10
                }
                ...
            ]
        }
    ]
}

About

Scripts to convert the OpenAir format to a JSON Format

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages