Description
I've been using this (awesome) library for generating Hilbert locations in building a map tiling engine. As the README states, for every zoom, the Hilbert curve rotates. A core property of the Hilbert curve is that relative position of items in the curve is maintained as the zoom changes. For example, this property should hold:
lower_zoom_hilbert = hilbert / (4^n) * (4^n-1)
Or more nicely:
lower_zoom_hilbert = hilbert >> 2
Because the rotation happens, these nice properties do not apply. I instead have to calculate a Hilbert location at a higher zoom and shift down for a lower zoom tile.
Is it possible to tweak the LUT so that this rotation does not happen?
z3 x4 y3 h31
z2 x2 y1 h13
z1 x1 y0 h1
Here we are with a tile at zoom 1. The hilbert location resolves to 1.
At zoom 2, the hilbert location resolves to 13 due to the rotation.
If I were to sort geographic data by their Hilbert location at one zoom, the locality will change for another, negating the static quadtree.
And then one more zoom in, and the direction of the preceding tile comes from the north.