bitmaskspatial-indexz-order-curve

How can I properly calculate bigmin and litmax during a z order range search?


This article explains how to calculate bigmin and litmax (big minimum and little max).

I have a hard time understanding the phrasing of the step 4 to see how it would translate to pseudocode, C or python.

Step 4

A horizontal division we know we need to calculate the Latitude value closest to the division line of yn. Take the most significant bit’s of both min and max up to where they first differ, yn, and call it y[1..m] we know that the Latitude value just above the division line will be binary coded y[1..m] 0111..., and y[1..m] 1000... which translates to our Latitude value for LitMax, and BigMin.

Since the most significant bit that differed in our example was y4, our LitMax and BigMin Latitude values equals 0111 and 1000.

In a vertical division we just reverse this to the x bits and Longitude.

I have no problem translating z order index from coord and vice versa.

I'm just interested in calculating bigmin and litmax since they allow a big speed up. I've searched and I can't find good details on those particular bitmask operations (the answer here How to use Morton Order(z order curve) in range search? doesn't really cover it, and neither does the linked dynamodb article).


Solution

  • Take a look to the page 76 decision tables in the original article http://hermanntropf.de/media/multidimensionalrangequery.pdf The ideas behind the Bigmin Calculation for Z-Indexing are described a bit more elaborately in the US patent US7321890B2 which is about using hilbert order instead of Z-order. See section 2: "BIGMIN Solution for Z-Indexing" which has been included to ease the description as much of the ideas in the patent is in common with the application to Hilbert indexing. https://patents.google.com/patent/US7321890B2/en?assignee=hermann+tropf&oq=hermann+tropf. Once realized for Bigmin, just take a look at the Litmax Decision Table in the original article. I hope this may help.