geoprimsField-grade geospatial math

S2

S2 cells: a point to a cell id or token at any level, what a cell covers, and the cells across its edges.

S2 projects a cube onto the sphere and splits each face into four children per level, from level 0 down to level 30, where cells are about 1 cm across. These tools turn a point into a cell id or token, describe what a cell covers, find its edge neighbors across cube faces, and cover a box or circle with cells. Developers use S2 for 64-bit spatial keys and region coverings. Start with the point-to-cell tool. Pitfall: a token and a 64-bit id are two spellings of the same cell, so compare like with like.

I want to turn a point into an S2 cell, or read a token

I want to find the cells around one, including across a cube face

I want to cover a box or a circle with S2 cells