Skip to content

bigwhite/go-openflights

Repository files navigation

CircleCI GoDoc MIT License

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.

Introduction

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.

Flights uses protobuf and gRPC to auto-generate a protobuf/grpc API stubs, and a HTTP/JSON API. See openflights.proto for the API definition. The HTTP endpoints should be relatively straightfoward.

The binary openflightsd is a server binary that hosts the API. make install will install this, which you can then run with ${GOPATH}/bin/openflightsd, or 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/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 binaries gen-openflights-csv-store and gen-openflights-id-store will generate the data for you in either a CSVStore or IDStore. Note that this is how generated.go is generated.

Future Work

Please contact me if you want to help out!