wgs84

package
v0.0.0-...-64661d1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: MIT Imports: 3 Imported by: 1

Documentation

Overview

Package wgs84 is for distance, bearing, and locality calculations on the WGS84 ellipsoid.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compass

func Compass(bearing float64) string

Compass converts bearing (0-360) to a compass bearing name e.g., south-east.

func CompassShort

func CompassShort(bearing float64) string

CompassShort converts bearing (0-360) to a short compass bearing name e.g., N.

func DistanceBearing

func DistanceBearing(lat1, lon1, lat2, lon2 float64) (distance, bearing float64, err error)

DistanceBearing calculates the distance in km and the bearing in degrees from lat1 lon1 to lat2 lon2 on the WGS84 ellipsoid.

Based on https://github.com/StefanSchroeder/Golang-Ellipsoid

Types

type ByDistance

type ByDistance []Locality

func (ByDistance) Len

func (a ByDistance) Len() int

func (ByDistance) Less

func (a ByDistance) Less(i, j int) bool

func (ByDistance) Swap

func (a ByDistance) Swap(i, j int)

type Locality

type Locality struct {
	Name                string
	Longitude, Latitude float64
	Distance            float64
	Bearing             float64
}

func ClosestNZ

func ClosestNZ(latitude, longitude float64) (Locality, error)

ClosestNZ returns the closest New Zealand locality to the input point. Locality.Bearing is from the Locality to the input point.

func LocalitiesNZ

func LocalitiesNZ(latitude, longitude float64) ([]Locality, error)

LocalitiesNZ returns New Zealand localities for the input point. Locality.Bearing is from the Locality to the input point.

func (Locality) Description

func (l Locality) Description() string

func (Locality) DescriptionShort

func (l Locality) DescriptionShort() string

Jump to

Keyboard shortcuts

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