simple-aviation-api v1.0.1
simple-aviation-api
A simple node package for getting information about the world's airports, airlines, planes and countries. The data is fetched from https://openflights.org/data.html.
Installation
Use the Node Package Manager to install the package.
npm i simple-aviation-apiUsage
The index.js file exports methods for getting different data. All methods will return either a object or an array of objects. If no objects can be found, the return will be underfined for get...() or [] for getAll...().
The full list of get methods are in index.js.
Example of getting information about Oslo Gardermoen Airport based on the property 'icao' with the value 'ENGM':
const aviation = require('simple-aviation-api');
var x = aviation.getAirportBy('icao', 'ENGM');
// Returns an airport object: {"id":"644","name":"Oslo Lufthavn", ...}Example of getting information about all airports in Norway based on the property 'country' with the value 'Norway':
const aviation = require('simple-aviation-api');
var x = aviation.getAllAirportsBy('country', 'Norway');
// Returns an array of airport objects: [airport, airport, ...]Properties for airlines
idnamealiasiataicaocallsigncountryisActive
Properties for airports
idnamecitycountryiataicaolatitudelongitudealtitudehrsOffsetUTCdsttimezonetypesource
Properties for countries
nameisoCodedafifCode
Properties for planes
nameiataicao
How it works
A posinstall task fetches each CSV file from OpenFlights, parses it and saves it as a .json file in data/. From now on, the data is read locally by the get methods inside index.js.
To update the data, run fetch.js:
node fetchContributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
License
This package is licenced under MIT.\ But keep in mind you must also follow the licenses for the OpenFlights database.\ More information about these licenses