Tool to decode / encode coordinates with Geohash, a geographic data representation system used on to shorten url on geohash.org
Geohash - dCode
Tag(s) : Geography
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
Geohash is the name of an algorithm, created in 2008 and deposited in the public domain, which transforms a pair (latitude, longitude) of GPS coordinates into a code of letters and numbers.
The binary value is divided by distinguishing 1 bit out of 2 in order to create 2 other binary numbers, the first being associated with the longitude, the second the latitude.
Example: 0110001011000000110001101 becomes 0_1_0_1_1_0_0_0_1_0_0_1_1 (longitude) and _1_0_0_0_1_0_0_0_1_0_1_0_ (latitude)
The values are then treated as a dichotomy indicator with the interval -180;+180 for longitude and -90;+90 for latitude. The idea is to split the interval in 2 at each step and take 0 for the right part and 1 for the left part. The more bits there are, the more accurate the value.
Example: The longitude 0101100010011
|Bit||Left Interval||Right Interval|
Example: The geohash dc0de string corresponds to +6.08642578125 ; -55.39306640625
From the GPS coordinates, the geohash is calculated by creating two binary strings, one for the longitude and one for the latitude, by dichotomy of the corresponding intervals. By splitting each interval into 2 equal parts and noting 0 the left interval and 1 the right interval.
Example: Code a latitude of +12.34 starting from the interval -90;+90, take the right interval (noted 1), ie 0;+90, then the left interval (noted 0) is 0;+45, then the left interval =0 is 0;+22.5, etc... until the desired accuracy is obtained. Same for the longitude +12.34 with the interval -180;+180. The 2 numbers obtained are respectively 10010001100011001 and 100010001100011001.
From the 2 binary numbers, recompose a single binary number alternately composed of a bit of longitude and a bit of latitude
Example: 100010001100011001 and 10010001100011001 make 11000001100000011110000001111000011
Convert the resulting binary number to base 32 using the characters 0123456789bcdefghjkmnpqrstuvwxyz
Example: 11000001100000011110000001111000011 in base 2 is s60y0y3 in this special base 32