More developers should use s2 geometry
last updated: Dec 19, 2025
S2 fits a sweet spot for indexing spatial data, not visualization or aggregate statistics. The Google reference implementation is in C++, which makes it difficult to use for web maps. Enter Peter Johnson’s s2js, a from-scratch implementation of S2 Geometry in pure JavaScript, with most major features such as RegionCoverer and boolean operations.
They link to a neat demo app where you draw a rectangle or polygon on a map, and it breaks it down into sub-regions using the s2 algorithm.