geo

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: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Distance

func Distance(lat1, lon1, lat2, lon2 float64) float64

Distance distance between points in meters

Types

type AirportRecord

type AirportRecord struct {
	// Name of airport, eg, Dublin
	Name string
	// Code is the ICAO issued airport code, eg, EIDW
	Code string
	// CountryCode is two letter country code, eg, IE
	CountryCode string
	// Latitude is milli degrees, with N/S suffix, eg, 5325.278N
	Latitude float64
	// Latitude is milli degrees, with E/W suffix, eg, 00616.206W
	Longitude float64
	// Elevation in meters, with meter suffix, eg, 9.0m
	Elevation float64
	// Style of airport
	Style string
}

AirportRecord - defines an airport and information about its location

type Geocoder

type Geocoder interface {
	// ReverseGeocode takes a lat/lon and tries to return a location
	// name, and the distance to the location from the input point.
	// The final error value is set upon failure. If no error is returned,
	// the address + distance fields may be zero values if no results
	// are found
	ReverseGeocode(lat float64, lon float64) (string, float64, error)
}

Geocoder interface specifies methods to find a name for a location

type NearestAirportGeocoder

type NearestAirportGeocoder struct {
	// contains filtered or unexported fields
}

NearestAirportGeocoder - implements Geocoder. Shards locations based on a geohash.

func NewNearestAirportGeocoder

func NewNearestAirportGeocoder(ghlen uint) *NearestAirportGeocoder

NewNearestAirportGeocoder takes ghlen and returns an initialized NearestAirportGeocoder

func (*NearestAirportGeocoder) Register

func (g *NearestAirportGeocoder) Register(locs []AirportRecord) error

Register adds a list of AirportRecords to the Geocoder.

func (*NearestAirportGeocoder) ReverseGeocode

func (g *NearestAirportGeocoder) ReverseGeocode(lat float64, lon float64) (string, float64)

ReverseGeocode - see Geocoder.ReverseGeocode Converts location to geohash, finds nearby locations, and returns the location with the shortest distance to (lat, lon) if there was any airports nearby.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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