About me

and my company, Geolytica inc

Location Codes

From X,Y to Z

Encoding geographic coordinates into a string is a trivial thing. Yet, there are many grid based systems

M L S, Geohash, Mapcodes, Plus codes, O P C, N A C, XADDRESS, What3words, Zippr, MapTags, OkHi, Geokey, FB ...

Reinventing the wheel?


Geocode Attributes

  • Free

    Same as Latitude,Longitude. (Eratosthenes circa 3rd century BC)
  • Short

    Optimal location encoding.
  • Spatial Locality

    2D <-> 1D
  • Memorizable / Distinct

    For Humans
  • Deterministic

    Must be generated offline.
  • Unique

    One to One


And Open Source:


 33.75850,-118.22020  LA-ABXXD 
 40.78286,-73.974109  NY-JSYXG  

City names are shortened to acronyms whenever possible.

Spatial Locality

 33.75850,-118.22020  LA-ABXXD 
 33.75860,-118.22020  LA-ABXWY 
 33.75870,-118.22020  LA-ABXWZ 
 33.75850,-118.22030  LA-ABXWS 
 33.75850,-118.22040  LA-ABXWT 
 33.75850,-118.22050  LA-ABXWO 

Memorizable / Distinct



Geonames have Levenshtein distance of at least 2. 

Phonetic distance of at least 1 (Metaphone Algorithm).



use Geo::Code;

my $g = Geo::Code->new();
my $geocode = $g->geocode(lat=>52.52699,lon=>13.40521);

my $xy = $g->geocode(gc=>$geocode);
my ($lat,$lon) = @$xy;


 33.75850,-118.22020  LA-ABXXD
 LA-ABXXD  33.75850,-118.22020


Under the hood - The Algorithm

Divide Earth into 510100 'Hilbert' simple polygons each polygon into squares use skiplist data structures to name each square.

Each polygon is about 1000 km2, each square is about 100 m2 or 1 m2 (triple geoname version)

No Database is needed.

Hilbert Curve

Hilbert curve properties

  • Quick Encoding/decoding
  • Spatial locality preservation
A Hilbert polygon for Berlin.


A triple geoname geocode for the world.

  • Resolution

    1x1 metre grid of the world.
  • Hilbert space of 720 trillion squares

    latitude range of [90.00000,-90.00000]
    and longitude range of [180.00000,-180.00000]
  • 3GeoName Geocode

    A unique 3 geoname address for each 1x1 m2 cell.

Other Attributes

In addition to being precise, geocodes are also:


  • Custom Geoname lists

    Greater Levenshtein/Phonetic distance for better error correction.
  • Adaptive Hilbert polygons

    Variable size polygons for remote areas
  • Other languages

    Translated geonames based on geonames.org are available



Reverse Geocoding.