func Example() { // Uluru in Australian Outback lat, lng := -25.345457, 131.036192 // Encode a full 12 character string geohash fmt.Println(geohash.Encode(lat, lng)) // Or at lower precision fmt.Println(geohash.EncodeWithPrecision(lat, lng, 6)) // As an integer fmt.Printf("%016x\n", geohash.EncodeInt(lat, lng)) // Decode to a point fmt.Println(geohash.Decode("qgmpvf18")) // or to a bounding box fmt.Println(geohash.BoundingBox("qgmpvf18")) // Output: // qgmpvf18h86e // qgmpvf // b3e75db828820cd5 // -25.3454 131.036 // {-25.345458984375 -25.345287322998047 131.03599548339844 131.03633880615234} }
func BenchmarkMmcloughlinEncode(b *testing.B) { for i := 0; i < b.N; i++ { mmcloughlin_geohash.EncodeWithPrecision(testPoint.Lat, testPoint.Lon, testPrecision) } }
func ExampleEncodeWithPrecision() { fmt.Println(geohash.EncodeWithPrecision(48.858, 2.294, 5)) // Output: u09tu }