maidenhead

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 License: MIT Imports: 4 Imported by: 14

README

go-maidenhead

Go Report Card

Maidenhead Locator system in Golang

Documentation

Overview

Package maidenhead implements the Maidenhead Locator System, a geographic coordinate system used by amataur radio (HAM) operators.

Index

Constants

View Source
const (
	FieldPrecision = iota + 1
	SquarePrecision
	SubSquarePrecision
	ExtendedSquarePrecision
)

Precision of the computed locator.

Variables

This section is empty.

Functions

This section is empty.

Types

type Point

type Point struct {
	Latitude  float64
	Longitude float64
}

Point is a geographical point on the map.

func NewPoint

func NewPoint(latitude, longitude float64) Point

NewPoint returns a new Point structure with given latitude and longitude.

func ParseLocator

func ParseLocator(locator string) (Point, error)

ParseLocator parses a Maidenhead Locator with permissive rule matching.

func ParseLocatorCentered

func ParseLocatorCentered(locator string) (Point, error)

ParseLocatorCentered parses a Maidenhead Locator with permissive rule matching. Returns Points structure with coordinates of the square center

func ParseLocatorStrict

func ParseLocatorStrict(locator string) (Point, error)

ParseLocatorStrict parses a Maidenhead Locator with strict rule matching.

func ParseLocatorStrictCentered

func ParseLocatorStrictCentered(locator string) (Point, error)

ParseLocatorStrictCentered parses a Maidenhead Locator with strict rule matching. Returns Points structure with coordinates of the square center

func (Point) Bearing

func (p Point) Bearing(heading Point) float64

Bearing calculates the (approximate) bearing to another heading.

func (Point) CompassBearing

func (p Point) CompassBearing(heading Point) string

CompassBearing returns the compass bearing to a heading.

func (Point) Distance

func (p Point) Distance(other Point) float64

Distance calculates the (approximate) distance to another point in km.

func (Point) EqualTo

func (p Point) EqualTo(other Point) bool

EqualTo returns true if the coordinates point to the same geographical location.

func (Point) GridSquare

func (p Point) GridSquare() (string, error)

GridSquare returns a Maidenhead Locator for the point coordinates.

func (Point) Locator

func (p Point) Locator(precision int) (string, error)

Locator returns a Maidenhead Locator for the point coordinates with specified precision

func (Point) String

func (p Point) String() string

String returns a stringified Point structure.

Jump to

Keyboard shortcuts

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