andys8 / elm-geohash / Geohash

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

Thanks to Ning Sun for the JavaScript implementation.

Functions

encode : Basics.Float -> Basics.Float -> Basics.Int -> String

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

encode 57.648 10.41 6 == "u4pruy"

decodeCoordinate : String -> { lat : Basics.Float, lon : Basics.Float, latError : Basics.Float, lonError : Basics.Float }

Decodes geohash and returns center coordinate.

decodeCoordinate "u281zk"
    == { lat = 48.14483642578125
       , lon = 11.5740966796875
       , latError = 0.00274658203125
       , lonError = 0.0054931640625
       }

decodeBoundingBox : String -> { minLat : Basics.Float, minLon : Basics.Float, maxLat : Basics.Float, maxLon : Basics.Float }

Decodes a geohash and returns the bounding box.

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