1. monoid
  2. fgh

Overview

HTTPS SSH
fgh is a fast JavaScript encoder and decoder of GeoHash format.  GeoHash
encodes geographic coordinates on Earth into compact string.

fgh is written by Ivan Boldyrev <lispnik@gmail.com> and licensed under
GPL-3 license (see LICENSE file).

* API

Fgh’s functions are grouped into Fgh object.  There are currently only
three functions:

  + Function Fgh.decode(string) returns object with two fields: lat
    and lon (latitude and longitude respectively).

  + Function Fgh.encode(lat, lon, bitlen) encodes coordinates (lat and
    lon).  Bitlen defines output length of string.  If you need
    string of length N, then bitlen should be equal to 5*N.  If you
    want to encode coordinates for Google Maps on zoom level Z, bitlen
    should be equal to 2*(8+Z).

  + Function Fgh.checkValid(string) returns true if string is a valid
    GeoHash string (i.e. it is not empty and contains no invalid
    characters).


* Development

You may get development version of Fgh from Mercurial repository:

$ hg clone http://bitbucket.org/monoid/fgh/