Skip to content

90 re-orientation on iteration breaks locality property. #7

Closed
@hallahan

Description

@hallahan

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.
Screen Shot 2022-10-28 at 9 12 46 PM

At zoom 2, the hilbert location resolves to 13 due to the rotation.
Screen Shot 2022-10-28 at 9 15 07 PM

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.
Screen Shot 2022-10-28 at 9 18 38 PM

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions