Giter Site home page Giter Site logo

commenthol / openflights-data Goto Github PK

View Code? Open in Web Editor NEW
16.0 3.0 3.0 697 KB

REST microservice for openflights airports and airlines data

License: The Unlicense

JavaScript 95.63% HTML 3.95% CSS 0.36% Shell 0.06%
airlines airports iata icao openflights rest-api icao-codes iata-codes

openflights-data's Introduction

openflights-data

REST microservice for openflights airports and airlines data

Get airport and airline data via REST API.

Run Example

npm install
cd example && npm install && npm run build && cd ..
npm start

Open http://localhost:3003

screenshot

Usage with express server

const {router} = require('openflights-data')
const app = require('express')()

app.use('/', router())
app.listen(3000)

Just access data.

const {loadData} = require('openflights-data')

loadData(config).then(data => console.log(data))

API

Get airport by IATA Code

Returns GeoJSON Feature

GET /airports/iata/:code
// e.g.
GET /airports/iata/aaa

{
  type: 'Feature',
  geometry: {
    type: 'Point',
    coordinates: [-145.50999450683594, -17.35260009765625]
  },
  properties: {
    id: '1973',
    name: 'Anaa Airport',   // name of airport
    city: 'Anaa',           // city name
    iata: 'AAA',
    icao: 'NTGA',
    alt: 10,                // altitude in ft
    tz: 'Pacific/Tahiti',   // timezone
    country: 'PF',          // ISO-3166 Country Code
    type: 'airport'         // type: airport, airbase, heliport, seaplane,
                            //       airfield, bus, port, station
  }
}

Get airport by ICAO Code

Returns GeoJSON Feature

GET /airports/icao/:code

Search airport by name

Returns GeoJSON FeatureCollection

GET /airports/search/:search
// e.g.
GET /airports/search/leonardo+da

{
  type: 'FeatureCollection',
  features: [
    {
      type: 'Feature',
      geometry: {
        type: 'Point',
        coordinates: [12.2388889, 41.8002778]
      },
      properties: {
        id: '1555',
        name: 'Leonardo da Vinci–Fiumicino Airport',
        city: 'Rome',
        iata: 'FCO',
        icao: 'LIRF',
        alt: 13,
        tz: 'Europe/Rome',
        country: 'IT',
        type: 'airport'
      }
    }
  ]
}

Get airports by bounding box

Returns GeoJSON FeatureCollection

GET /airports/bbox/:north,:west/:south,:east
// example get all airports within lat 49, lng 8 and lat 48, lng 7
GET /airports/bbox/49,8/48,7

// filter by country, type, iata, icao
GET /airports/bbox/:north,:west/:south,:east?country=C1,C2&type=t1,t2&iata=1&icao=1
// example get all swiss airfields
GET /airports/bbox/47.54,6.38/45.73,10.77?country=CH&type=airfield

Get airline by IATA code

Returns airline object

GET /airlines/iata/:code
// e.g.
GET /airlines/iata/4u
{
  id: '2548',
  name: 'Germanwings',
  iata: '4U',
  icao: 'GWI',
  callsign: 'GERMAN WINGS',
  active: true,
  country: 'DE'
}

Get airline by ICAO code

GET /airlines/icao/:code

Get airline by callsign

GET /airlines/callsign/:callsign

Search airline by name

Returns Array of airline objects

GET /airlines/search/:search

Data

Data is obtained from openflights under ODBL-1.0 and downloaded as postinstall task.

If you like to improve the data please open an issue here.

License

Unlicense https://unlicense.org

openflights-data's People

Contributors

commenthol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

openflights-data's Issues

Openflight Data has changed

Hi!

I just used a good 2+ hours debugging my project and i ended up to debug this package. Openflight has changed their data, there is now one extra column, mostly saying "OurAirports". I don't have the purpose of this data, but to fix this issue, you need to change the headers in data.js, row 84, new row with for example "ExtraData" as the new input. Sorry i don't time to do you a pr for you, but go ahead and test this.

To produce the error, please make a fresh install of the package, loadData().then((res)=>{console.log(res.iata)}) and boom, there you have an empty object of airport by iata.

--
Joonas

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.