lat lng encryption tripda
by Deepak Kumar
HTML
<div id="hash"></div>
<div id="dehash"></div>
JavaScript
var geohash = function() {
var geohash = {
success_callback: null,
error_callback: null,
base32_to_decimal: {
0: 0,
1: 1,
2: 2,
3: 3,
4: 4,
5: 5,
6: 6,
7: 7,
8: 8,
9: 9,
b: 10,
c: 11,
d: 12,
e: 13,
f: 14,
g: 15,
h: 16,
j: 17,
k: 18,
m: 19,
n: 20,
p: 21,
q: 22,
r: 23,
s: 24,
t: 25,
u: 26,
v: 27,
w: 28,
x: 29,
y: 30,
z: 31
},
decimal_to_base32: {
0: 0,
1: 1,
2: 2,
3: 3,
4: 4,
5: 5,
6: 6,
7: 7,
8: 8,
9: 9,
10: "b",
11: "c",
12: "d",
13: "e",
14: "f",
15: "g",
16: "h",
17: "j",
18: "k",
19: "m",
20: "n",
21: "p",
22: "q",
23: "r",
24: "s",
25: "t",
26: "u",
27: "v",
28: "w",
29: "x",
30: "y",
31: "z"
},
locate: function(success, error) {
geohash.success_callback = success, geohash.error_callback = error, navigator.geolocation.getCurrentPosition(geohash.success, geohash.error)
},
success: function(position) {
position.coords.hash = geohash.hash(position.coords.latitude, position.coords.longitude), void 0 != geohash.success_callback && (geohash.success_callback(position), geohash.success_callback = null)
},
error: function() {
void 0 != geohash.error_callback && (geohash.error_callback(),...