openaip

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractOpenAIPRecords

func ExtractOpenAIPRecords(aip *File) ([]geo.AirportRecord, error)

ExtractOpenAIPRecords takes aip and converts all the airports into geo.AirportRecords. The list is returned if successful, and if not an error is returned.

Types

type Airport

type Airport struct {
	// XMLName - entity name
	XMLName     xml.Name    `xml:"AIRPORT"`
	Type        string      `xml:"TYPE,attr"`
	Identifier  string      `xml:"IDENTIFIER"`
	Country     string      `xml:"COUNTRY"`
	Name        string      `xml:"NAME"`
	Icao        string      `xml:"ICAO"`
	Geolocation Geolocation `xml:"GEOLOCATION"`
}

Airport - main structure containing aircraft information

type Elevation

type Elevation struct {
	// XMLName - entity name
	XMLName xml.Name `xml:"ELEV"`
	// Unit - unit as string
	Unit string `xml:"UNIT,attr"`
	// Value: altitude (todo: MASL? what type?)
	Value float64 `xml:",chardata"`
}

Elevation - containing elevation value and units

type File

type File struct {
	// XMLName - entity name
	XMLName    xml.Name  `xml:"OPENAIP"`
	Version    string    `xml:"VERSION,attr"`
	DataFormat string    `xml:"DATAFORMAT,attr"`
	Waypoints  Waypoints `xml:"WAYPOINTS"`
}

File - main structure of openaip file

func Parse

func Parse(contents []byte) (*File, error)

Parse decodes contents and returns the decoded File if successful. If not, an error is returned.

func ParseFile

func ParseFile(file string) (*File, error)

ParseFile takes an openaip filepath and returns the decoded File if if successful. If not, an error is returned.

type Geolocation

type Geolocation struct {
	// XMLName - entity name
	XMLName   xml.Name  `xml:"GEOLOCATION"`
	Latitude  string    `xml:"LAT"`
	Longitude string    `xml:"LON"`
	Elevation Elevation `xml:"ELEV"`
}

Geolocation - containing position information for the airport

type Waypoints

type Waypoints struct {
	// XMLName - entity name
	XMLName  xml.Name  `xml:"WAYPOINTS"`
	Airports []Airport `xml:"AIRPORT"`
}

Waypoints - contains a list of Airports.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL