Member Login

Lost your password?

Registration is closed

Sorry, you are not allowed to register by yourself on this site!


Fgh: GeoHash library in JavaScript

Fgh is a JavaScript encoder and decoder of GeoHash format.  GeoHash encodes geographic coordinates on Earth into compact string.

Fgh is currently licensed under GPL-3.

API

Fgh’s functions are grouped into Fgh object.

  • 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 in bits.  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). (Earlier version of the documentation incorrectly described different ordering of arguments: lon, lat, bitlen).
  • Function Fgh.checkValid(string) returns true if string is a valid GeoHash string (i.e. it is not empty and contains no invalid characters).

Downloading

  • fgh-0.1 released on August 4, 2009.

You may get development version of Fgh from Mercurial repository:

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