geo

package
v0.0.0-...-99c9b17 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package geo provides functionality for distance calculation between two positions on the Earth. Positions can be provided in two froms: latitude/longitude or as Maidenhead QTH locator. Conversion between latitude/longitude to Maidenhead QTH locator and vice versa is supported in this package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LocatorDistance

func LocatorDistance(locatorA string, locatorB string) (float64, error)

LocatorDistance returns distance between two Maidenhead locators in km and any error encountered LocatorDistance is mainly used in tests. Preferred function for distance calculation is Distance

Types

type QTH

type QTH struct {
	Loc    string             // Maidenhead QTH Locator
	LatLon internal.LatLonDeg // LatLon represent a point as a pair of latitude and longitude degrees
	LatLng s2.LatLng          // LatLng represents a point on the unit sphere as a pair of angles.
}

QTH represents Maidenhead QTH Locator and associated a pair of latitude and longitude Use function NewQthFromLocator or NewQthFromPosition to create QTH

func NewQthFromLocator

func NewQthFromLocator(locator string) (QTH, error)

NewQthFromLocator returns QTH for locator. Locator is case-insensitive 2, 4 or 6 characters; example: - JN - jN76 - jn76TO

func NewQthFromPosition

func NewQthFromPosition(latitude, longitude float64) (QTH, error)

NewQthFromPosition returns QTH for latitude and longitude in decimal degrees

func (QTH) AzimuthTo

func (a QTH) AzimuthTo(b QTH) float64

AzimuthTo Calculates forward azimuth in decimal degrees from a to b Original Implementation from: http://www.movable-type.co.uk/scripts/latlong.html

func (QTH) Distance

func (a QTH) Distance(b QTH) float64

Distance returns distance between a and b in km

func (QTH) DistanceAndAzimuth

func (a QTH) DistanceAndAzimuth(b QTH) (dist, azimuth float64)

DistanceAndAzimuth returns distance in km and azimuth in decimal degrees from a to b

func (QTH) String

func (a QTH) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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