Skip to content

gansidui/geohash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

##geohash

geohash algorithm: https://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

About

geohash for golang

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages