andys8/elm-geohash/1.1.2

NOTE: the latest version is 1.1.3

Geohash

This module is a Geohash encoding and decoding implementation in pure Elm.

Thanks to Ning Sun for the JavaScript implementation.

Functions

encode : Float -> Float -> Int -> String

Encodes coordinate (latitude, longitude, precision) to geohash.

encode 57.648 10.41 6 == "u4pruy"
String
-> { lat : Float
, lon : Float
, latError : Float
, lonError : Float
}

Decodes geohash and returns center coordinate.

decodeCoordinate "u281zk"
    == { lat = 48.14483642578125
       , lon = 11.5740966796875
       , latError = 0.00274658203125
       , lonError = 0.0054931640625
       }
String
-> { minLat : Float
, minLon : Float
, maxLat : Float
, maxLon : Float
}

Decodes a geohash and returns the bounding box.

decodeBoundingBox "u281zk" =
    { minLat = 48.14208984375
    , minLon = 11.568603515625
    , maxLat = 48.1475830078125
    , maxLon = 11.57958984375
    }