haversine

package module
v0.0.0-...-4e5c000 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2020 License: MIT Imports: 1 Imported by: 0

README

haversine

This module uses the commonly used haversine formula for calculating small distances between two points.

Example

package main

import (
	"fmt"
	"pault.ag/go/haversine"
)

func main() {
	whiteHouse := haversine.Point{Lat: 38.89768, Lon: -77.03653}
	eighteenAndF := haversine.Point{Lat: 38.89736, Lon: -77.04173}

	fmt.Printf("%f\n", float64(whiteHouse.MetresTo(eighteenAndF)))
	/* 451.41 Metres (float64) */
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Delta

type Delta struct {
	Lat float64
	Lon float64
}

type Metres

type Metres float64

func Distance

func Distance(origin, position Point) Metres

type Point

type Point struct {
	Lat float64
	Lon float64
}

func (Point) Delta

func (p Point) Delta(point Point) Delta

func (Point) MetresTo

func (p Point) MetresTo(remote Point) Metres

Jump to

Keyboard shortcuts

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