nearest

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package tool copied from https://gist.github.com/antoniomo/3371e44cbe2f0cc75a525aac0d188cfb

Index

Constants

View Source
const (
	EarthRadiusKm   = 6371.01 // Earth's mean radius, km (according to NASA).
	Helsinki        = "helsinki"
	Oxford          = "oxford"
	OxfordPubs      = "oxford-pubs"
	PointDelimiter  = "::"
	PointsDelimiter = "|"
	Tolkien         = "tolkien"
)

Tool constants

Variables

View Source
var (
	HelsinkiCenter        = "60.1699::24.9384::Helsinki Center"
	HelsinkiExamplePoints = "60.2934::25.0378::Vantaa Center|" +
		"60.2055::24.6559::Espoo Center|" +
		"60.1699::24.9380::Person in Helsinki|" +

		"50.0::150.0::Seah of Okhotsk|" +
		"50.0::-150.0::North Pacific Ocean|" +
		"50.0::50.0::Western Kazakhstan|" +
		"50.0::-50.0::Labrador Sea"
	OxfordExamplePoints = "51.751944::-1.257778::Oxford|" +
		"51.7572::-1.2603::The Eagle and Child|" +
		"51.507222::-0.1275::London|" +
		"51.48::0::Greenwich|" +
		"52.205278::0.119167::Cambridge|" +

		"42.116667::-71.865278::Oxford, Massachusetts|" +
		"-43.312778::172.190556::Oxford, New Zealand"
	// Pints points
	OxfordPubExamplePoints = "51.7572::-1.2603::The Eagle and Child|" +
		"51.7550609::-1.2617064::Morse Bar|" +
		"51.755::-1.2544::The King's Arms|" +
		"51.7546135::-1.2577909::The White Horse|" +
		"51.7547::-1.253::The Turf Tavern"
	TolkiensHouse = "51.770903::-1.2626219::Tolkien's House"
)

Example Points

View Source
var PointSplitterOpts = &SplitterOpts{
	MinVars:   2,
	MaxVars:   3,
	Delimiter: PointDelimiter,
}

PointSplitterOpts ...

Functions

func AngleToKm

func AngleToKm(angle s1.Angle) float64

AngleToKm ...

func ConvertLatLon

func ConvertLatLon(lat, lon string) (float64, float64)

ConvertLatLon ...

func KmToAngle

func KmToAngle(km float64) s1.Angle

KmToAngle converts a distance on the Earth's surface to an angle. https://github.com/golang/geo/blob/23949e136d58aeb8aa39844a312b68d90c4eb8aa/s2/s2_test.go#L38-L43

func PointsInCellID

func PointsInCellID(s2cap s2.Cap, cov s2.CellID, center Point, points []Point)

PointsInCellID ...

func Splitter

func Splitter(s string, opts *SplitterOpts, vars ...*string) error

Splitter ...

Types

type Point

type Point struct {
	CellID s2.CellID
	LatLon s2.LatLng
	Name   string
}

Point ...

func NewPoint

func NewPoint(lat, lon float64, name string) Point

NewPoint ...

func ParsePoint

func ParsePoint(delimited string) Point

ParsePoint ...

func ParsePoints

func ParsePoints(delimited string) []Point

ParsePoints ...

type RunOptions

type RunOptions struct {
	CapRadius   float64
	CenterPoint string
	MaxCells    int
	MaxLevel    int
	Points      string
}

RunOptions ...

type SplitterOpts

type SplitterOpts struct {
	Delimiter string
	MinVars   int
	MaxVars   int
}

SplitterOpts ...

Jump to

Keyboard shortcuts

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