module

Geohash

Geohash encoding/decoding and associated functions

https://en.wikipedia.org/wiki/Geohash

Based on https://github.com/davetroy/geohash-js/blob/master/geohash.js

Constants

VERSION = {{ (`shards version /tmp/tmp.KcDjpG/src/src`).chomp.stringify }}

Instance methods

bounds(geohash) : NamedTuple(sw: NamedTuple(lat: Float64, lng: Float64), ne: NamedTuple(lat: Float64, lng: Float64))

Returns SW/NE latitude/longitude bounds of specified geohash.

Source
decode(geohash : String) : NamedTuple(lat: Float64, lng: Float64)

Decode geohash to latitude/longitude (location is approximate center of geohash cell, to reasonable precision).

Geohash.decode("u120fxw") # => {lat: 52.205, lng: 0.1188}
Source
encode(latitude : Float64, longitude : Float64, precision : Int32) : String

Encodes latitude/longitude to geohash, either to specified precision or to automatically evaluated precision.

Geohash.encode(52.205, 0.119, 7) # => "u120fxw"
Source
encode(latitude : Float64, longitude : Float64) : String

Encodes latitude/longitude to geohash, either to specified precision or to automatically evaluated precision.

Geohash.encode(48.669, -4.329) # => "gbsuv"
Source
neighbors(geohash : String) : NamedTuple(n: String, ne: String, e: String, se: String, s: String, sw: String, w: String, nw: String)

Returns all 8 adjacent cells to specified geohash.

Source