Documentation ¶
Index ¶
- Constants
- Variables
- func AirportTypeFromString(typ string) uint64
- func Clear(af *AirportFinder)
- func Distance(fromLatitudeDeg, fromLongitudeDeg, toLatitudeDeg, toLongitudeDeg float64) float64
- func DownloadDatabase(targetDir string)
- func KilometersToMeters(km float64) float64
- func MetersToKilometers(m float64) float64
- func MetersToMiles(m float64) float64
- func MetersToNauticalMiles(m float64) float64
- func MilesToMeters(mi float64) float64
- func MinInt(a, b int) int
- func NauticalMilesToMeters(nm float64) float64
- func ParseBool(str string) bool
- func ParseFloat(str string) (float64, error)
- func ParseInt(str string) (int64, error)
- func ParseUint(str string) (uint64, error)
- type Airport
- type AirportDB
- func (db *AirportDB) Clear()
- func (db *AirportDB) FindAll(isoRegionFilter string, isoCountryFilter string, continentFilter string, ...) []*AirportData
- func (db *AirportDB) FindByAirportType(airportTypeFilter uint64) []*AirportData
- func (db *AirportDB) FindByContinent(continent string, airportTypeFilter uint64) []*AirportData
- func (db *AirportDB) FindByCountry(isoCountry string, airportTypeFilter uint64) []*AirportData
- func (db *AirportDB) FindByIATACode(iataCode string) *AirportData
- func (db *AirportDB) FindByICAOCode(icaoCode string) *AirportData
- func (db *AirportDB) FindByRegion(isoRegion string, airportTypeFilter uint64) []*AirportData
- func (db *AirportDB) FindNearestAirport(latitudeDeg, longitudeDeg, radius float64, airportTypeFilter uint64) *AirportData
- func (db *AirportDB) FindNearestAirports(latitudeDeg, longitudeDeg, radiusMeters float64, maxResults int, ...) []*AirportData
- func (db *AirportDB) Parse(file string, airportTypeFilter uint64, skipFirstLine bool) error
- type AirportData
- type AirportFinder
- func (af *AirportFinder) FindAirportByIATACode(iataCode string) *Airport
- func (af *AirportFinder) FindAirportByICAOCode(icaoCode string) *Airport
- func (af *AirportFinder) FindAirportByType(airportTypeFilter uint64) []*Airport
- func (af *AirportFinder) FindAllAirports(isoRegionFilter, isoCountryFilter, continentFilter string, ...) []*Airport
- func (af *AirportFinder) FindAllNavaids(isoCountryFilter string) []*Navaid
- func (af *AirportFinder) FindNavaidsByAirportICAOCode(icaoCode string) []*Navaid
- func (af *AirportFinder) FindNearestAirport(latitudeDeg, longitudeDeg, radiusMeters float64, airportTypeFilter uint64) *Airport
- func (af *AirportFinder) FindNearestAirports(latitudeDeg, longitudeDeg, radiusMeters float64, maxResults int, ...) []*Airport
- func (af *AirportFinder) FindNearestAirportsByCountry(isoCountry string, latitudeDeg, longitudeDeg, radiusMeters float64, ...) []*Airport
- func (af *AirportFinder) FindNearestAirportsByRegion(isoRegion string, latitudeDeg, longitudeDeg, radiusMeters float64, ...) []*Airport
- func (af *AirportFinder) FindNearestNavaids(latitudeDeg, longitudeDeg, radiusMeters float64, maxResults int) []*Navaid
- func (af *AirportFinder) Load(options *LoadOptions, airportFilter uint64) []error
- type Country
- type CountryDB
- type CountryData
- type Frequency
- type FrequencyDB
- type FrequencyData
- type LoadOptions
- type MyProgress
- type Navaid
- type NavaidDB
- type NavaidData
- type Region
- type RegionDB
- type RegionData
- type Runway
- type RunwayDB
- type RunwayData
Constants ¶
View Source
const ( AirportTypeUnknown uint64 = 0x00 AirportTypeClosed uint64 = 0x01 AirportTypeHeliport uint64 = 0x02 AirportTypeSeaplaneBase uint64 = 0x04 AirportTypeSmall uint64 = 0x08 AirportTypeMedium uint64 = 0x10 AirportTypeLarge uint64 = 0x20 AirportTypeAll uint64 = AirportTypeClosed | AirportTypeHeliport | AirportTypeSeaplaneBase | AirportTypeSmall | AirportTypeMedium | AirportTypeLarge AirportTypeActive uint64 = AirportTypeHeliport | AirportTypeSeaplaneBase | AirportTypeSmall | AirportTypeMedium | AirportTypeLarge AirportTypeRunways uint64 = AirportTypeSmall | AirportTypeMedium | AirportTypeLarge )
View Source
const ( AirportsFileKey = "airports" FrequenciesFileKey = "frequencies" RunwaysFileKey = "runways" RegionsFileKey = "regions" CountriesFileKey = "countries" OurAirportsBaseURL = "https://ourairports.com/data/" )
View Source
const ( AirportTypeClosedName = "closed" AirportTypeSmallName = "small_airport" AirportTypeMediumName = "medium_airport" AirportTypeLargeName = "large_airport" AirportTypeHeliportName = "heliport" AirportTypeSeaplaneBaseName = "seaplane_base" AirportTypeUnknownName = "unknown" )
View Source
const ( DegToRad float64 = math.Pi / 180.0 EarthRadius float64 = 6371.0 * 1000.0 )
Variables ¶
View Source
var OurAirportsFiles = map[string]string{ AirportsFileKey: "airports.csv", FrequenciesFileKey: "airport-frequencies.csv", RunwaysFileKey: "runways.csv", RegionsFileKey: "regions.csv", CountriesFileKey: "countries.csv", NavaidsFileKey: "navaids.csv", }
Functions ¶
func AirportTypeFromString ¶
func Clear ¶
func Clear(af *AirportFinder)
func Distance ¶
see https://stackoverflow.com/questions/43167417/calculate-distance-between-two-points-in-leaflet returns the distance between to coordinates in meters
func DownloadDatabase ¶
func DownloadDatabase(targetDir string)
Download csv files from OurAirports.com
func KilometersToMeters ¶
func MetersToKilometers ¶
func MetersToMiles ¶
func MetersToNauticalMiles ¶
func MilesToMeters ¶
func NauticalMilesToMeters ¶
func ParseFloat ¶
Types ¶
type Airport ¶
type Airport struct { ICAOCode string Type string Name string LatitudeDeg float64 LongitudeDeg float64 ElevationFt int64 Continent string Municipality string ScheduledService bool GPSCode string IATACode string LocalCode string HomeLink string WikipediaLink string Keywords string Region Region Country Country Runways []Runway Frequencies []Frequency }
func NewAirport ¶
func NewAirport(airport *AirportData, region *RegionData, country *CountryData, frequencies []*FrequencyData, runways []*RunwayData, navaids []*NavaidData) *Airport
type AirportDB ¶
type AirportDB struct {
Airports []*AirportData
}
func NewAirportDB ¶
func NewAirportDB() *AirportDB
func (*AirportDB) FindByAirportType ¶
func (db *AirportDB) FindByAirportType(airportTypeFilter uint64) []*AirportData
func (*AirportDB) FindByContinent ¶
func (db *AirportDB) FindByContinent(continent string, airportTypeFilter uint64) []*AirportData
func (*AirportDB) FindByCountry ¶
func (db *AirportDB) FindByCountry(isoCountry string, airportTypeFilter uint64) []*AirportData
func (*AirportDB) FindByIATACode ¶
func (db *AirportDB) FindByIATACode(iataCode string) *AirportData
func (*AirportDB) FindByICAOCode ¶
func (db *AirportDB) FindByICAOCode(icaoCode string) *AirportData
func (*AirportDB) FindByRegion ¶
func (db *AirportDB) FindByRegion(isoRegion string, airportTypeFilter uint64) []*AirportData
func (*AirportDB) FindNearestAirport ¶
func (db *AirportDB) FindNearestAirport(latitudeDeg, longitudeDeg, radius float64, airportTypeFilter uint64) *AirportData
func (*AirportDB) FindNearestAirports ¶
func (db *AirportDB) FindNearestAirports(latitudeDeg, longitudeDeg, radiusMeters float64, maxResults int, airportTypeFilter uint64) []*AirportData
type AirportData ¶
type AirportData struct { ID uint64 ICAOCode string Type string TypeFlag uint64 Name string LatitudeDeg float64 LongitudeDeg float64 ElevationFt int64 Continent string ISOCountry string ISORegion string Municipality string ScheduledService bool GPSCode string IATACode string LocalCode string HomeLink string WikipediaLink string Keywords string }
func FindNearestAirports ¶
func FindNearestAirports(airports []*AirportData, latitudeDeg, longitudeDeg, radiusMeters float64, maxResults int) []*AirportData
type AirportFinder ¶
type AirportFinder struct {
// contains filtered or unexported fields
}
func NewAirportFinder ¶
func NewAirportFinder() *AirportFinder
func (*AirportFinder) FindAirportByIATACode ¶
func (af *AirportFinder) FindAirportByIATACode(iataCode string) *Airport
func (*AirportFinder) FindAirportByICAOCode ¶
func (af *AirportFinder) FindAirportByICAOCode(icaoCode string) *Airport
func (*AirportFinder) FindAirportByType ¶
func (af *AirportFinder) FindAirportByType(airportTypeFilter uint64) []*Airport
func (*AirportFinder) FindAllAirports ¶
func (af *AirportFinder) FindAllAirports(isoRegionFilter, isoCountryFilter, continentFilter string, airportTypeFilter uint64) []*Airport
func (*AirportFinder) FindAllNavaids ¶
func (af *AirportFinder) FindAllNavaids(isoCountryFilter string) []*Navaid
func (*AirportFinder) FindNavaidsByAirportICAOCode ¶
func (af *AirportFinder) FindNavaidsByAirportICAOCode(icaoCode string) []*Navaid
func (*AirportFinder) FindNearestAirport ¶
func (af *AirportFinder) FindNearestAirport(latitudeDeg, longitudeDeg, radiusMeters float64, airportTypeFilter uint64) *Airport
func (*AirportFinder) FindNearestAirports ¶
func (af *AirportFinder) FindNearestAirports(latitudeDeg, longitudeDeg, radiusMeters float64, maxResults int, airportTypeFilter uint64) []*Airport
func (*AirportFinder) FindNearestAirportsByCountry ¶
func (*AirportFinder) FindNearestAirportsByRegion ¶
func (*AirportFinder) FindNearestNavaids ¶
func (af *AirportFinder) FindNearestNavaids(latitudeDeg, longitudeDeg, radiusMeters float64, maxResults int) []*Navaid
func (*AirportFinder) Load ¶
func (af *AirportFinder) Load(options *LoadOptions, airportFilter uint64) []error
type Country ¶
type Country struct { ISOCode string Name string Continent string WikipediaLink string Keywords string }
func NewCountry ¶
func NewCountry(country *CountryData) *Country
type CountryDB ¶
type CountryDB struct {
Countries map[string]*CountryData
}
func NewCountryDB ¶
func NewCountryDB() *CountryDB
func (*CountryDB) FindByISOCode ¶
func (db *CountryDB) FindByISOCode(isoCode string) *CountryData
type CountryData ¶
type Frequency ¶
func NewFrequency ¶
func NewFrequency(frequency *FrequencyData) *Frequency
type FrequencyDB ¶
type FrequencyDB struct {
Frequencies map[uint64][]*FrequencyData
}
func NewFrequencyDB ¶
func NewFrequencyDB() *FrequencyDB
func (*FrequencyDB) Clear ¶
func (db *FrequencyDB) Clear()
func (*FrequencyDB) FindByAirportID ¶
func (db *FrequencyDB) FindByAirportID(airportID uint64) []*FrequencyData
type FrequencyData ¶
type LoadOptions ¶
type LoadOptions struct { AirportsFilename string // required, usually: airports.csv FrequenciesFilename string // optional, usually: airport-frequencies.csv RunwaysFilename string // optional, usually: runways.csv RegionsFilename string // optional, usually: regions.csv CountriesFilename string // optional, usually: countries.csv }
func PresetLoadOptions ¶
func PresetLoadOptions(baseDir string) *LoadOptions
type MyProgress ¶
type MyProgress struct{}
func (MyProgress) Done ¶
func (p MyProgress) Done(sourceURL string)
func (MyProgress) Start ¶
func (p MyProgress) Start(sourceURL string)
type NavaidDB ¶
type NavaidDB struct {
}func NewNavaidDB ¶
func NewNavaidDB() *NavaidDB
func (*NavaidDB) FindByAirportICAOCode ¶
func (db *NavaidDB) FindByAirportICAOCode(icaoCode string) []*NavaidData
func (*NavaidDB) FindNearestNavaids ¶
func (db *NavaidDB) FindNearestNavaids(latitudeDeg, longitudeDeg, radiusMeters float64, maxResults int) []*NavaidData
type NavaidData ¶
type NavaidData struct {}
type Region ¶
type Region struct { ISOCode string LocalCode string Name string WikipediaLink string Keywords string }
func NewRegion ¶
func NewRegion(region *RegionData) *Region
type RegionDB ¶
type RegionDB struct {
Regions map[string]*RegionData
}
func NewRegionDB ¶
func NewRegionDB() *RegionDB
func (*RegionDB) FindByISOCode ¶
func (db *RegionDB) FindByISOCode(isoCode string) *RegionData
type RegionData ¶
type Runway ¶
type Runway struct { LengthFt int64 WidthFt int64 Surface string Lighted bool Closed bool LowEndIdent string LowEndLatitudeDeg float64 LowEndLongitudeDeg float64 LowEndElevationFt int64 LowEndHeadingDegT float64 LowEndDisplacedThresholdFt int64 HighEndIdent string HighEndLatitudeDeg float64 HighEndLongitudeDeg float64 HighEndElevationFt int64 HighEndHeadingDegT float64 HighEndDisplacedThresholdFt int64 }
func NewRunway ¶
func NewRunway(runway *RunwayData) *Runway
type RunwayDB ¶
type RunwayDB struct {
Runways map[uint64][]*RunwayData
}
func NewRunwayDB ¶
func NewRunwayDB() *RunwayDB
func (*RunwayDB) FindByAirportID ¶
func (db *RunwayDB) FindByAirportID(airportID uint64) []*RunwayData
type RunwayData ¶
type RunwayData struct { ID uint64 AirportID uint64 AirportIdent string LengthFt int64 WidthFt int64 Surface string Lighted bool Closed bool LowEndIdent string LowEndLatitudeDeg float64 LowEndLongitudeDeg float64 LowEndElevationFt int64 LowEndHeadingDegT float64 LowEndDisplacedThresholdFt int64 HighEndIdent string HighEndLatitudeDeg float64 HighEndLongitudeDeg float64 HighEndElevationFt int64 HighEndHeadingDegT float64 HighEndDisplacedThresholdFt int64 }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.