Socket
Socket
Sign inDemoInstall

airports-data

Package Overview
Dependencies
64
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    airports-data

Airports data: static, dynamic and custom dump.


Version published
Maintainers
1
Install size
3.01 MB
Created

Readme

Source

airports-data stable

npm version styled with prettier

Airports data: static, dynamic and custom dump. Data from OpenFlights Airports Database.

Installation

npm install airports-data

NPM

Usage

const fs = require("fs");
const getAirportsData = require("airports-data");

process.on("unhandledRejection", err => {
  console.error(err);
  process.exit(1);
});

async function dumpData() {
  const data = await getAirportsData({
    dynamic: true,
    keys: ["name", "iata"]
  });
  fs.writeFileSync("airports.json", JSON.stringify(data));
}

dumpData();

API

getAirportsData(options): Promise<AirportData[]>

OptionTypeDefaultDescription
optionsobject?
options.dynamicboolean?falseRequest the latest data online.
options.keysstring?[] | string?undefinedApply a simple filtering to the loaded data (both statically and dynamically). Array of strings or string with comma separated keys.

CLI

Usage
	$ airports-data

Options
	--dynamic, -d  Get data from https://openflights.org/data.html#airport instead of the local dump [Default: false]
	--keys, -k  Keys to include [Default:
		id
		name
		city
		country
		iata
		icao
		latitude
		longitude
		altitude
		timezone
		dst
		tz
		type
		source
	]

Examples
	$ airports-data
	[..., {"id":1382,"name":"Charles de Gaulle International Airport","city":"Paris","country":"France","iata":"CDG","icao":"LFPG","latitude":49.0127983093,"longitude":2.54999995232,"altitude":392,"timezone":1,"dst":"E","tz":"Europe/Paris","type":"airport","source":"OurAirports"}, ...]
	$ airports-data --keys name,iata
	[..., {"name":"Charles de Gaulle International Airport","iata":"CDG"}, ...]

Data

KeyDescription
idUnique OpenFlights identifier for this airport.
nameName of airport. May or may not contain the City name.
cityMain city served by airport. May be spelled differently from Name.
countryCountry or territory where airport is located. See countries.dat to cross-reference to ISO 3166-1 codes.
iata3-letter IATA code. null if not assigned/unknown.
icao4-letter ICAO code. null if not assigned.
latitudeDecimal degrees, usually to six significant digits. Negative is South, positive is North.
longitudeDecimal degrees, usually to six significant digits. Negative is West, positive is East.
altitudeIn feet.
timezoneHours offset from UTC. Fractional hours are expressed as decimals, eg. India is 5.5.
dstDaylight savings time. One of E (Europe), A (US/Canada), S (South America), O (Australia), Z (New Zealand), N (None) or U (Unknown).
tzTimezone in "tz" (Olson) format, eg. "America/Los_Angeles".
typeType of the airport. Value "airport" for air terminals, "station" for train stations, "port" for ferry terminals and "unknown" if not known.
sourceSource of this data. "OurAirports" for data sourced from OurAirports, "Legacy" for old data not matched to OurAirports (mostly DAFIF), "User" for unverified user contributions.

License

MIT. See license file.

Keywords

FAQs

Last updated on 12 Oct 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc