geo

package
v0.0.0-...-13f918f Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2016 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PreComputedExtraAngles map[int]float64 = map[int]float64{
	100: 120.0,
	75:  88.0,
	50:  56.0,
	25:  28.0,
	20:  22.0,
	10:  12.0,
	0:   180.0,
}

Precalculated angles to speed up the process. This is to build the base of the cone based on how much further do we allow the the geo asset at its current position to go beyond its destination to reach the via point

Functions

func Bearings

func Bearings(pLat, pLng, qLat, qLng float64) (float64, float64)

Bearing calculates the initial and final angles (in degrees) taken on the route (P, Q) using Great Circle navigation. All latitudes and longitudes are expected to be in degrees. The current method is most suitable for short distances.

func Haversine

func Haversine(xLat, xLon, yLat, yLon float64) float64

Haversine uses the haversine formula to return a great-circle distance between two latitude/longitude points. Distance returned is in kilometers.

func HaversineInMeters

func HaversineInMeters(xLat, xLon, yLat, yLon float64) float64

Returns the distance between two points (given by lat and long coordinates) in meters

func IsInPath

func IsInPath(currentLat, currentLng, destinationLat, destinationLng, viaLat, viaLng, extraDestinationAngle, coneAngle float64) bool

isInPath determines whether the location via which we are going through is in the cone formed by the current position and the destination

Types

This section is empty.

Jump to

Keyboard shortcuts

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