How to Convert Latitude and Longitude to Quadkey for Easy Joins

At Iggy we use quadkey as the index for our location features. Quadkeys, like other geospatial indexes such as H3, subdivide the Earth into a regular grid of polygons. They are a hierarchical indexing scheme - the highest “zoom level” quadkey is a polygon drawn from subdividing the Earth into quadrants, the next zoom level subdivides each of those quadrants into quadrants, etc. A specific quadkey index value encodes both the location of the corresponding polygon as well as the resolution of the grid it is assigned to. 

A useful feature of quadkeys is that they make spatial joins simple. If you have two datasets of points-of-interest (POIs), with lat/long pairs or addresses identifying where the points live on a map, you can assign each POI to the quadkey it intersects, and then easily join the two datasets using the quadkey indices. Below is an interactive walkthrough of how this can be done.