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/yaixm-to-geojson

v0.5.0

Published

Converts YAIXM to GeoJSON. YAIXM is a simplified version of the FAA/EUROCONTOL Aeronautical Information Exchange Model (AIXM) using YAML.

Downloads

4

Readme

YAIXM to GeoJSON Converter

A utility that converts YAIXM format into GeoJSON for Node. This tool is intended to work with the YAIXM format used in the unofficial UK Airspace Repository. Currently, the logic only supports reading airspace YAIXM definitions.

Internally, the logic uses parts of our OpenAIR Parser to also validate the given YAIXM definitions.

Reads YAIXM airspace definition:

airspace:
    - name: ABERDEEN CTA
      id: aberdeen-cta
      type: CTA
      class: D
      geometry:
          - seqno: 1
            upper: FL115
            lower: 1500 ft
            boundary:
                - line:
                      - 572153N 0015835W
                      - 572100N 0015802W
                      - 572100N 0023356W
                - arc:
                      dir: cw
                      radius: 10 nm
                      centre: 571834N 0021602W
                      to: 572153N 0015835W
          - seqno: 2
            upper: FL115
            lower: 1500 ft
            boundary:
                - line:
                      - 571522N 0015428W
                      - 570845N 0015019W
                - arc:
                      dir: cw
                      radius: 10 nm
                      centre: 570531N 0020740W
                      to: 570214N 0022458W
                - line:
                      - 570850N 0022913W
                - arc:
                      dir: ccw
                      radius: 10 nm
                      centre: 571207N 0021152W
                      to: 571522N 0015428W
          - seqno: 3
            upper: FL115
            lower: 3000 ft
            boundary:
                - line:
                      - 572100N 0023356W
                      - 570015N 0025056W
                      - 565433N 0023557W
                      - 565533N 0020635W
                - arc:
                      dir: cw
                      radius: 10 nm
                      centre: 570531N 0020740W
                      to: 570214N 0022458W
                - line:
                      - 571520N 0023326W
                - arc:
                      dir: cw
                      radius: 10 nm
                      centre: 571834N 0021602W
                      to: 572100N 0023356W

    - name: ARGYLL CTA
      type: CTA
      class: E
      geometry:
          - seqno: 1
            class: E
            rules:
                - TMZ
            upper: FL195
            lower: 5500 ft
            boundary:
                - line:
                      - 561844N 0054648W
                      - 560727N 0050308W
                      - 560127N 0044028W
                      - 560000N 0044400W
                      - 555356N 0045343W
                      - 555825N 0051042W
                      - 560939N 0055411W
          - seqno: 2
            rules:
                - TMZ
            upper: FL195
            lower: FL115
            boundary:
                - line:
                      - 564819N 0062031W
                      - 561807N 0054423W
                      - 561844N 0054648W
                      - 560939N 0055411W
                      - 562501N 0065609W
                      - 563408N 0064847W
                      - 562552N 0061508W
                      - 564248N 0063539W
          - seqno: 3
            rules:
                - TMZ
            upper: FL195
            lower: FL105
            boundary:
                - line:
                      - 553039N 0053655W
                      - 552543N 0050000W
                      - 551527N 0050000W
                      - 552057N 0054102W

Outputs a GeoJSON FeatureCollection with the following JSON schema:

{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "https://adhoc-schemas.openaip.net/schemas/parsed-yaixm-airspace.json",
    "description": "JSON Schema for the GeoJSON FeatureCollection returned by this converter.",
    "type": "object",
    "properties": {
        "type": {
            "type": "string",
            "enum": [
                "FeatureCollection"
            ],
            "description": "A GeoJSON FeatureCollection object that contains all airspace features."
        },
        "features": {
            "type": "array",
            "items": {
                "allOf": [
                    {
                        "type": "object",
                        "properties": {
                            "type": {
                                "type": "string",
                                "enum": [
                                    "Feature"
                                ]
                            },
                            "properties": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "description": "The airspace's name."
                                    },
                                    "type": {
                                        "type": "string",
                                        "enum": [
                                            "CTA",
                                            "TMA",
                                            "CTR",
                                            "ATZ",
                                            "DANGER",
                                            "PROHIBITED",
                                            "RESTRICTED",
                                            "WARNING",
                                            "AERIAL_SPORTING_RECREATIONAL",
                                            "RMZ",
                                            "TMZ",
                                            "MATZ",
                                            "GLIDING_SECTOR"
                                        ],
                                        "description": "The airspace's type."
                                    },
                                    "class": {
                                        "type": "string",
                                        "enum": [
                                            "A",
                                            "B",
                                            "C",
                                            "D",
                                            "E",
                                            "F",
                                            "G",
                                            "UNCLASSIFIED"
                                        ],
                                        "description": "The airspace's class."
                                    },
                                    "activity": {
                                        "type": "string",
                                        "enum": [
                                            "NONE",
                                            "PARACHUTING",
                                            "AEROBATICS",
                                            "AEROCLUB_AERIAL_WORK",
                                            "ULM",
                                            "HANG_GLIDING"
                                        ],
                                        "description": "Property that adds metadata about specific type of arial/sporting areas. Is 'NONE' by default."
                                    },
                                    "upperCeiling": {
                                        "$ref": "#/definitions/verticalLimit"
                                    },
                                    "lowerCeiling": {
                                        "$ref": "#/definitions/verticalLimit"
                                    },
                                    "activatedByNotam": { "type": "boolean", "description": "If true, the airspace is activated by a NOTAM." },
                                    "groundService": {
                                        "type": "object",
                                        "properties": {
                                            "callsign": { "type": "string" , "example": "ABERDEEN APPROACH"},
                                            "frequency": { "type": "string", "example": "118.000" }
                                        },
                                        "description": "The ground service callsign and frequency if available.",
                                        "required": [
                                            "callsign",
                                            "frequency"
                                        ],
                                        "additionalProperties": false
                                    },
                                    "remarks": {
                                        "type": "string",
                                        "description": "A remarks field. If available, this will contain content of the parsed 'rules' list to add more metadata on the airspace."
                                    }
                                },
                                "required": [
                                    "name",
                                    "type",
                                    "class",
                                    "upperCeiling",
                                    "lowerCeiling",
                                    "activatedByNotam",
                                    "activity"
                                ],
                                "additionalProperties": false
                            },
                            "geometry": {
                                "type": "object",
                                "properties": {
                                    "type": {
                                        "type": "string",
                                        "enum": [
                                            "Polygon"
                                        ]
                                    },
                                    "coordinates": {
                                        "type": "array",
                                        "items": {
                                            "type": "array",
                                            "items": {
                                                "type": "array",
                                                "items": false,
                                                "prefixItems": [
                                                    {
                                                        "type": "number",
                                                        "minimum": -180,
                                                        "maximum": 180
                                                    },
                                                    {
                                                        "type": "number",
                                                        "minimum": -90,
                                                        "maximum": 90
                                                    }
                                                ],
                                                "minItems": 2,
                                                "maxItems": 2
                                            },
                                            "minItems": 4
                                        },
                                        "minItems": 1,
                                        "maxItems": 1
                                    }
                                },
                                "required": [
                                    "type",
                                    "coordinates"
                                ],
                                "additionalProperties": false,
                                "example": {
                                    "type": "Polygon",
                                    "coordinates": [
                                        [
                                            [
                                                9.1234,
                                                45.42432
                                            ],
                                            [
                                                10.1234,
                                                45.42432
                                            ],
                                            [
                                                10.1234,
                                                47.42432
                                            ],
                                            [
                                                9.1234,
                                                45.42432
                                            ]
                                        ]
                                    ]
                                }
                            }
                        },
                        "required": [
                            "type",
                            "properties",
                            "geometry"
                        ],
                        "additionalProperties": false
                    }
                ]
            }
        }
    },
    "required": [
        "type",
        "features"
    ],
    "additionalProperties": false,
    "definitions": {
        "verticalLimit": {
            "type": "object",
            "properties": {
                "value": {
                    "type": "integer"
                },
                "unit": {
                    "type": "string",
                    "enum": [
                        "FT",
                        "FL"
                    ]
                },
                "referenceDatum": {
                    "type": "string",
                    "enum": [
                        "GND",
                        "STD",
                        "MSL"
                    ]
                }
            },
            "required": [
                "value",
                "unit",
                "referenceDatum"
            ],
            "description": "Defines an airspace vertical limit. The vertical limit is a combination of an integer value, a measurement unit and a reference datum.",
            "additionalProperties": false
        }
    }
}

Install

npm install -g @openaip/yaixm-to-geojson

Node

const { YaixmConverter } = require('@openaip/yaixm-to-geojson');

const inputFilePath = './path/to/input-yaixm-file.txt';

const converter = new YaixmConverter({ fixGeometries: true, strictSchemaValidation: true });
// or alternatively call "convertFromBuffer" to read from Buffer
await converter.convertFromFile(inputFilepath, { type: 'airspace' });
const geojson = converter.toGeojson();

CLI

node cli.js -h

Usage: cli [options]

Options:
  -f, --input-filepath <inputFilepath>    The input file path to the YAIXM file.
  -o, --output-filepath <outputFilepath>  The output filename of the generated GeoJSON file.
  -T, --type                              The type to read from YAIXM file. Currently only "airspace" is supported. (default: "airspace")
  -V, --validate                          If specified, converter will validate geometries.
  -F, --fix-geometry                      If specified, converter will try to fix geometries.
  -S, --strict-schema-validation          If specified, converter will strictly validate the created GeoJSON against the underlying schema. If the GeoJSON does not match the JSON schema, the converter will throw an error.
  -h, --help                              Outputs usage information.

Simple command line usage:

node cli.js --type=airspace -f ./path/to/input-yaixm-file.txt -o ./path/to/output-geojson-file.geojson