geohash

package module
v0.0.0-...-947f039 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2016 License: MIT Imports: 1 Imported by: 0

README

geohash

Integer based geohash for golang

hash1 := geohash.FromCoordinates(latitude, longitude)
uinthash := hash.Hash()
hash2 := geohash.FromHash(h, 64)
latitude, longitude = hash2.Coordinates()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Direction

type Direction int
const (
	North Direction = iota
	NorthEast
	East
	SouthEast
	South
	SouthWest
	West
	NorthWest
)

type GeoHash

type GeoHash interface {
	Hash() uint64
	Coordinates() (latitude, longitude float64)

	// 1..64, the higher the better
	Precision() uint
	GetInPrecision(precision uint) GeoHash

	// will return adjacent hash in the precision the hash is
	GetAdjacent(dir Direction) GeoHash

	GetNeighbors() [8]GeoHash

	GetHashRangesInside(radius float64) []Range
}

full precision hash

func FromCoordinates

func FromCoordinates(latitude, longitude float64) GeoHash

Return full precision hash which contains the given coordinates

func FromHash

func FromHash(hash uint64, precision uint) GeoHash

type Range

type Range struct {
	Min uint64
	Max uint64
}

Jump to

Keyboard shortcuts

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