Tiling geographic regions

So, I updated my geoid package to support region tiling. This is the process of subdividing any region on the globe into a list of squares which are uniquely identified using 64 bit numbers -- this effectively changes and "point in region" tests into finding if an integer is in a list of sorted integers, an operation which is extremely fast even for regions of arbitrary complexity.

This can be used to create fast indexes for geographic regions and I used it to update the tzgelookup package and make it about 10 times faster (the tzgeolookup package determines the time zone for a latitude/longitude coordinate).

This has been an interesting project for me (and I wasted too much time on it), but among other things it required me to to strict equality tests on floating point numbers, as well as write a distributed tiling process and run it on all the laptops I found in my house, since I was too cheap to rent VMs on a cloud provider :slight_smile:

I wrote some more notes about it here:



I also like how the squares reveal some of the "warping" between the real world coordinates and the 2D map projection.

Yes, the geoids don't look like rectangles on a Mercator projection map, perhaps the most extreme example is the covering for the "Antarctica/McMurdo" zone which covers the south pole:

However, they really are square when projected onto a plane tangent to the south pole: