Go OpenSky API Functions¶
func NewConnection¶
Creates a new connection context to OpenSky Network live API server.
func NewConnection(ctx context.Context, username string, password string) (context.Context, error)
- Parameters:
ctx (context.Context) - connection context.
username (string) - an OpenSky username (Anonymous connection will be use by providing empty username).
password (string) - an OpenSky password for the given username.
- Returns:
context.Context, error
func GetStates¶
Retrieve state vectors for a given time.
func GetStates(ctx context.Context, time int64, icao24 []string, bBox *BoundingBoxOptions, extended bool) (*States, error)
- Parameters:
ctx (context.Context) - connection context.
time (int64) - time as Unix time stamp (seconds since epoch) or datetime. The datetime must be in UTC!. If
time = 0
the most recent ones are taken.icao24 ([]string) - optionally retrieve only state vectors for the given ICAO24 address(es). The parameter an array of str containing multiple addresses.
bBox (*BoundingBoxOptions) - optionally retrieve state vectors within a bounding box. Use NewBoundingBox function to create a new one.
extended (bool) - set to
true
to request the category of aircraft- Returns:
*States, error
func GetArrivalsByAirport¶
Retrieves flights for a certain airport which arrived within a given time interval [being, end].
The given time interval must not be larger than seven days!
func GetArrivalsByAirport(ctx context.Context, airport string, begin int64, end int64) ([]FlightData, error)
- Parameters:
ctx (context.Context) - connection context.
airport (string) - ICAO identifier for the airport.
begin (int64) - Start of time interval to retrieve flights for as Unix time (seconds since epoch).
end (int64) - End of time interval to retrieve flights for as Unix time (seconds since epoch).
- Returns:
[]FlightData, error
func GetDeparturesByAirport¶
Retrieves flights for a certain airport which departed within a given time interval [being, end].
The given time interval must not be larger than seven days!
func GetDeparturesByAirport(ctx context.Context, airport string, begin int64, end int64) ([]FlightData, error)
- Parameters:
ctx (context.Context) - connection context.
airport (string) - ICAO identifier for the airport.
begin (int64) - Start of time interval to retrieve flights for as Unix time (seconds since epoch).
end (int64) - End of time interval to retrieve flights for as Unix time (seconds since epoch).
- Returns:
[]FlightData, error
func GetFlightsByInterval¶
Retrieves flights within a given time interval [being, end].
The given time interval must not be larger than two hours!
func GetFlightsByInterval(ctx context.Context, begin int64, end int64) ([]FlightData, error)
- Parameters:
ctx (context.Context) - connection context.
airport (string) - ICAO identifier for the airport.
begin (int64) - Start of time interval to retrieve flights for as Unix time (seconds since epoch).
end (int64) - End of time interval to retrieve flights for as Unix time (seconds since epoch).
- Returns:
[]FlightData, error
func GetFlightsByAircraft¶
Retrieves flights for a particular aircraft within a certain time interval.
The given time interval must not be larger than 30 days!
func GetFlightsByAircraft(ctx context.Context, icao24 string, begin int64, end int64) ([]FlighData, error)
- Parameters:
ctx (context.Context) - connection context.
icao24 (string) - Unique ICAO 24-bit address of the transponder in hex string representation.
begin (int64) - Start of time interval to retrieve flights for as Unix time (seconds since epoch).
end (int64) - End of time interval to retrieve flights for as Unix time (seconds since epoch).
- Returns:
[]FlightData, error
func GetTrackByAircraft¶
Retrieves the trajectory for a certain aircraft at a given time.
It is not possible to access flight tracks from more than 30 days in the past.
func GetTrackByAircraft(ctx context.Context, icao24 string, time int64) (FlightTrack, error)
- Parameters:
ctx (context.Context) - connection context.
icao24 (string) - Unique ICAO 24-bit address of the transponder in hex string representation.
time (int64) - Unix time in seconds since epoch. It can be any time between start and end of a known flight. If time = 0, get the live track if there is any flight ongoing for the given aircraft.
- Returns:
FlightTrack, error
func NewBoundingBox¶
Creates a new bounding (min_latitude, max_latitude, min_longitude, max_longitude) box option.
func NewBoundingBox (lamin float64, lomin float64, lamax float64, lomax float64) *BoundingBoxOptions
- Parameters:
lamin (float64) - lower bound for the latitude in WGS84 decimal degrees.
lomin (float64) - lower bound for the longitude in in WGS84 decimal degrees.
lamax (float64) - upper bound for the latitude in WGS84 decimal degrees.
lomax (float64) - upper bound for the longitude in in WGS84 decimal degrees.
- Returns: