npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@openaip/openair-fix-format

v1.1.2

Published

OpenAIR format fixer. Parses openAIR formatted string, removes unnecessary blank lines and makes sure that geometry start and end points are equal.

Downloads

1

Readme

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 -g @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