Skip to content

Instantly share code, notes, and snippets.

@twuni
Created November 11, 2013 09:27
Show Gist options
  • Save twuni/7410430 to your computer and use it in GitHub Desktop.
Save twuni/7410430 to your computer and use it in GitHub Desktop.
The obfuscated version of the Google Maps JavaScript API v3's implementation of their Encoded Polyline Algorithm Format (https://developers.google.com/maps/documentation/utilities/polylinealgorithm).
function (a) {
for (var b = H(a), c = ea(l[gb](a[D] / 2)), d = 0, e = 0, f = 0, g = 0; d < b; ++g) {
var h = 1,
n = 0,
r;
do r = a[Kc](d++) - 63 - 1, h += r << n, n += 5; while (31 <= r);
e += h & 1 ? ~(h >> 1) : h >> 1;
h = 1;
n = 0;
do r = a[Kc](d++) - 63 - 1, h += r << n, n += 5; while (31 <= r);
f += h & 1 ? ~(h >> 1) : h >> 1;
c[g] = new O(1E-5 * e, 1E-5 * f, !0)
}
Wa(c, g);
return c
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment