Skip to content

openair-fix-format 1.1.0

Install from the command line:
Learn more about npm packages
$ npm install @openaip/openair-fix-format@1.1.0
Install via package.json:
"@openaip/openair-fix-format": "1.1.0"

About this version

OpenAIR Fix Format

A utility that fixes OpenAIR format for Node. This tool supports both the original and the extended format. Removes unnecessary blank lines,makes sure that defined geometries are "closed", i.e. start coordinate equals end coordinate and can also set required AI tag for the extended OpenAIR format.

Internally, the logic uses parts of our OpenAIR Parser to also validate the given OpenAIR file syntax.

Please note that this utility will not validate/fix the given OpenAIR airspace definitions!

If you require a robust solution that is able to validate tag values and fix geometries, please feel free to use our OpenAIR Parser.

Fixes original OpenAIR airspace definitions:

AC R
AN ED-R10B Todendorf-Putlos MON-SAT+
AH 40000ft MSL
AL GND
DP 54:25:00 N 010:40:00 E

DP 54:25:00 N 010:50:00 E
DP 54:26:00 N 010:53:00 E
DP 54:19:30 N 010:53:00 E

DP 54:15:00 N 010:41:00 E
DP 54:15:19 N 010:40:00 E
DP 54:20:00 N 010:40:00 E

Outputs fixed OpenAIR string:

AC R
AN ED-R10B Todendorf-Putlos MON-SAT+
AH 40000ft MSL
AL GND
DP 54:25:00 N 010:40:00 E
DP 54:25:00 N 010:50:00 E
DP 54:26:00 N 010:53:00 E
DP 54:19:30 N 010:53:00 E
DP 54:15:00 N 010:41:00 E
DP 54:15:19 N 010:40:00 E
DP 54:20:00 N 010:40:00 E
DP 54:25:00 N 010:40:00 E

Fixes and extends to extended OpenAIR airspace definitions with extendFormat: false:

If the AI token is not present, it will be injected into each airspace definition block with a random UUID v4 value.

AC UNCLASSIFIED
AY R
AN ED-R10B Todendorf-Putlos MON-SAT+
AH 40000ft MSL
AL GND
AG Station Name
AF 123.456
DP 54:25:00 N 010:40:00 E

DP 54:25:00 N 010:50:00 E
DP 54:26:00 N 010:53:00 E
DP 54:19:30 N 010:53:00 E

DP 54:15:00 N 010:41:00 E
DP 54:15:19 N 010:40:00 E
DP 54:20:00 N 010:40:00 E

Outputs fixed OpenAIR string:

AC UNCLASSIFIED
AY R
AN ED-R10B Todendorf-Putlos MON-SAT+
AI f456b6cf-177a-4947-95f6-08cc255b7e90
AG Station Name
AF 123.456
AH 40000ft MSL
AL GND
DP 54:25:00 N 010:40:00 E
DP 54:25:00 N 010:50:00 E
DP 54:26:00 N 010:53:00 E
DP 54:19:30 N 010:53:00 E
DP 54:15:00 N 010:41:00 E
DP 54:15:19 N 010:40:00 E
DP 54:20:00 N 010:40:00 E
DP 54:25:00 N 010:40:00 E

Fixes and extends to extended OpenAIR airspace definitions with extendFormat: false. Re-arrange tokens with fix-token-order: true:

Inject the AI token if no set for each airspace definition block. Additionally, re-orders token to be in the expected order. Note that using this feature will remove all inline comments from the file!

AC UNCLASSIFIED
AY R
AN ED-R10B Todendorf-Putlos MON-SAT+
AL GND
AH 40000ft MSL
AG Station Name
AF 123.456
DP 54:25:00 N 010:40:00 E

DP 54:25:00 N 010:50:00 E
DP 54:26:00 N 010:53:00 E
DP 54:19:30 N 010:53:00 E

DP 54:15:00 N 010:41:00 E
DP 54:15:19 N 010:40:00 E
DP 54:20:00 N 010:40:00 E

Outputs fixed OpenAIR string:

AC UNCLASSIFIED
AY R
AN ED-R10B Todendorf-Putlos MON-SAT+
AI f456b6cf-177a-4947-95f6-08cc255b7e90
AF 123.456
AG Station Name
AH 40000ft MSL
AL GND
DP 54:25:00 N 010:40:00 E
DP 54:25:00 N 010:50:00 E
DP 54:26:00 N 010:53:00 E
DP 54:19:30 N 010:53:00 E
DP 54:15:00 N 010:41:00 E
DP 54:15:19 N 010:40:00 E
DP 54:20:00 N 010:40:00 E
DP 54:25:00 N 010:40:00 E

Extended OpenAIR Format

The original OpenAIR format specification has multiple shortcomings to meet today's demand to reflect the various types of existing airspaces and provide additional metadata. To overcome these shortcomings, an extended OpenAIR format is introduced that has several new tags.

Extended Format Tags:

AI

A required unique identifier string for each airspace, e.g. a UUID v4. The AI value must stay the same for each airspace throughout different versions if the file. The AI tag must be placed either before or directly after the AN tag. Placing the AI tag before the AN tag is preferred

AY

The optional AY tag specifies the airspace type, e.g. "TMA", "CTR" or "TMZ". Unlike in the original format, the AC tag must now only be used to specify the airspace ICAO class. If airspace has no type, i.e. is only ICAO class, the AY tag can be omitted. The AY tag must be placed directly after the AC tag.

AF

An optional tag that specifies the frequency of a ground station that provides information on the defined airspace. The AF must be placed directly after either the AI tag or the AG tag. If placed after the AG tag, the AG tag must directly be placed after the AI tag. The proposed best order is AF, then AG.

AG

If AF is present, defines the ground station name. May not be used without the AF tag. The AG must be placed directly after either the AF tag or the AF tag. If placed after the AG tag, the AF tag must directly be placed after the AI tag. The proposed best order is AF, then AG.

Install

npm install @openaip/openair-fix-format

Node

const fixFormat = require('@openaip/openair-fix-format');

await fixFormat.fix({in: './path/to/input-openair-file.txt', out:'./path/to/output-openair-file.txt'});

CLI

node cli.js -h

Usage: cli [options]

Options:
  -f, --input-filepath <inFilepath>    The input file path to the openAIR file.
  -o, --output-filepath <outFilepath>  The output filename of the generated fixed OpenAIR file.
  -E, --extend-format                  If true, an additional "AI" token with a unique identifier is injected into each airspace block so that the file is compatible with the extended OpenAIR format. Defaults to "false".
  -O  --fix-token-order                If true, will re-order found tokens and put them into the expected order. Note that this will remove all inline comments from the airspace definition blocks! Defaults to "false".
  -h, --help                           Outputs usage information.

Simple command line usage:

node cli.js -f ./path/to/input-openair-file.txt -o ./path/to/output-openair-file.txt

Details


Assets

  • openair-fix-format-1.1.0.tgz

Download activity

  • Total downloads 0
  • Last 30 days 0
  • Last week 0
  • Today 0