Skip to content

Instantly share code, notes, and snippets.

@coreequip
Last active August 29, 2015 14:00
Show Gist options
  • Save coreequip/e598ea1bf50cd436bade to your computer and use it in GitHub Desktop.
Save coreequip/e598ea1bf50cd436bade to your computer and use it in GitHub Desktop.
Simplified calculation of a Bing QuadKey - see https://msdn.microsoft.com/en-us/library/bb259689.aspx
// Don't ask.
q=(parseInt((y).toString(2), 4) << 1 | parseInt((x).toString(2), 4)).toString(4);
// Z-Padding
(1<<z).toString(2).substr(1,z-q.length)+q;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment