Please donate to OpenFlights!
If you do use this, I ask you to donate to OpenFlights, the source for all the data in here as of now, at http://openflights.org/donate. Seriously, if you can afford it, the OpenFlights team is responsible for putting all this data together and maintaining it, and we owe it to them to support their work.
Note the custom import path!
import ( "go.pedge.io/openflights" )
Openflights is a package that exposes the data from http://openflights.org/data.html, available within https://github.com/jpatokal/openflights/tree/master/data.
The binary openflightsd is a server binary that hosts the API.
make install will install this, which you can
then run with
make launch will build a Docker image that is ~13MB as of now, and launch
this Docker image with the default ports set. Then, you can
curl http://0.0.0.0:8080/api/airports/code/sfo as a quick check.
The openflights package for golang adds some golang-specific additional functionality around the generated protocol buffers code. See openflights.go for publically-exposed structures.
The binary openflights is a CLI for the server. If
OPENFLIGHTS_ADDRESS is set, this will connect to a running
$ OPENFLIGHTS_ADDRESS=0.0.0.0:1747 openflights miles --min 500 vie-bru-ewr/mem-ord-ams-vie
Otherwise, this will create an effective server inside the CLI, doing all the initial calculations (slower):
$ openflights miles --min 500 vie-bru-ewr
The only command available right now is
miles, which will calculate the miles of a route, given by space-separated
airport codes. The flag
--min will use a minimum miles for a segment, useful for airline mileage calculations.
$ openflights miles --min 500 vie-bru-ewr-mem-ord-ams-vie VIE-BRU 576mi BRU-EWR 3681mi EWR-MEM 946mi MEM-ORD 500mi (491mi actual) ORD-AMS 4120mi AMS-VIE 598mi 10421mi (10412mi actual)
Please contact me if you want to help out!