locator

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 5 Imported by: 6

Documentation

Overview

Package locator implements the handling of maidenhead locators (https://en.wikipedia.org/wiki/Maidenhead_Locator_System)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Azimuth

func Azimuth(locator1, locator2 Locator) latlon.Degrees

Azimuth calculates the azimuth between two maidenhead locators in degrees. See http://www.movable-type.co.uk/scripts/latlong.html for more details.

func Distance

func Distance(locator1, locator2 Locator) latlon.Km

Distance calculates the great circle distance between two maidenhead locators in kilometers using the haversine formula. See http://www.movable-type.co.uk/scripts/latlong.html for more details.

func ToLatLon

func ToLatLon(locator Locator) latlon.LatLon

ToLatLon converts a maidenhead locator into a pair of latitude and longitude coordinates. The coordinates represent the center of the square with the given precision of the locator.

Types

type Locator

type Locator [8]byte

Locator represents a maidenhead locator with up to four pairs of characters. This is equivalent to an accuracy of 500m.

func LatLonToLocator

func LatLonToLocator(latLon latlon.LatLon, length int) Locator

LatLonToLocator converts latitude and longitude into a maidenhead locator of the given length. The length must be 2, 4, 6, or 8. The returned locator describes a square of the desired precision that contains the given coordinates.

func MustParse added in v0.2.2

func MustParse(s string) Locator

MustParse parses a maidenhead locator from a string and panicks if the given string is not valid.

func Parse

func Parse(s string) (Locator, error)

Parse parses a maidenhead locator from a string.

func (Locator) IsZero

func (l Locator) IsZero() bool

IsZero returns true if this locator is zero.

func (Locator) String

func (l Locator) String() string

Jump to

Keyboard shortcuts

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