geohash for golang
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
geohash.go
geohash_test.go

README.md

##geohash

geohash algorithm: http://en.wikipedia.org/wiki/Geohash

package main

import (
	"fmt"
	"github.com/gansidui/geohash"
)

func main() {
	latitude := 39.92324
	longitude := 116.3906
	precision := 5

	hash, box := geohash.Encode(latitude, longitude, precision)

	fmt.Println(hash)
	fmt.Println(box.MinLat, box.MaxLat, box.MinLng, box.MaxLng)

	neighbors := geohash.GetNeighbors(latitude, longitude, precision)
	for _, hash = range neighbors {
		fmt.Print(hash, " ")
	}
}

##LICENSE

MIT