latlon

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: 0

Documentation

Overview

Package latlon implements handling of geodetic coordinates as latitude and longitude.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Degrees

type Degrees float64

Degrees represents an angle in degrees.

func Azimuth

func Azimuth(latLon1, latLon2 LatLon) Degrees

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

func (Degrees) String

func (a Degrees) String() string

type Km

type Km float64

Km represents kilometers.

func Distance

func Distance(latLon1, latLon2 LatLon) Km

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

func (Km) String

func (d Km) String() string

type LatLon

type LatLon struct {
	Lat Latitude
	Lon Longitude
}

LatLon contains a pair of coordinates consisting of latitude and longitude.

func NewLatLon

func NewLatLon(lat Latitude, lon Longitude) LatLon

NewLatLon creates a new pair of coordinates. It normalizes the given latitude and longitude.

func ParseLatLon

func ParseLatLon(latString, lonString string) (LatLon, error)

ParseLatLon parses a latitude and longitude from two strings and returns the parsed data as LatLon.

func (LatLon) String

func (latLon LatLon) String() string

type Latitude

type Latitude float64

Latitude represents a latitudinal value in degrees.

func ParseLat

func ParseLat(s string) (Latitude, error)

ParseLat parses a string into a latitudinal value.

func (Latitude) String

func (lat Latitude) String() string

type Longitude

type Longitude float64

Longitude represents a longitudinal value in degrees.

func ParseLon

func ParseLon(s string) (Longitude, error)

ParseLon parses a string into a longitudinal value.

func (Longitude) String

func (lon Longitude) String() string

Jump to

Keyboard shortcuts

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