Module: GeoHash
- Defined in:
- lib/geohash.rb
Constant Summary collapse
- VERSION =
'1.0.1'
Instance Method Summary collapse
-
#decode(geohash, decimals = 5) ⇒ Object
Decode a geohash to a latitude and longitude with decimals digits.
-
#decode_bbox(geohash) ⇒ Object
Decode a geohash to a bounding box.
-
#encode(lat, lon, precision = 10) ⇒ Object
Encode latitude and longitude to a geohash with precision digits.
Instance Method Details
#decode(geohash, decimals = 5) ⇒ Object
Decode a geohash to a latitude and longitude with decimals digits
20 21 22 23 |
# File 'lib/geohash.rb', line 20 def decode(geohash, decimals=5) lat, lon = decode_base(geohash) [lat.decimals(decimals), lon.decimals(decimals)] end |
#decode_bbox(geohash) ⇒ Object
Decode a geohash to a bounding box
26 27 28 |
# File 'lib/geohash.rb', line 26 def decode_bbox(geohash) decode_bbox_base(geohash) end |
#encode(lat, lon, precision = 10) ⇒ Object
Encode latitude and longitude to a geohash with precision digits
15 16 17 |
# File 'lib/geohash.rb', line 15 def encode(lat, lon, precision=10) encode_base(lat, lon, precision) end |