S2 Geometry

A unique feature of the S2 library is that unlike traditional geographicinformation systems, which represent data as flat two-dimensional projections(similar to an atlas), the S2 library represents all data on a three-dimensionalsphere (similar to a globe). This makes it possible to build a worldwidegeographic database with no seams or singularities, using a single coordinatesystem, and with low distortion everywhere compared to the true shape of theEarth. While the Earth is not quite spherical, it is much closer to being asphere than it is to being flat!
If you want to learn more about the library, start by reading theOverview andQuickStart document, then read theintroduction to thebasic types
S2 Features
Notable features of the library include:
- Flexible support for spatial indexing, including the abilityto approximate arbitrary regions as collections of discreteS2 cells. This feature makes it easy to build large distributedspatial indexes.
- Fast in-memory spatial indexing of collections of points,polylines, and polygons.
- Robust constructive operations (such as intersection, union, andsimplification) and boolean predicates (such as testing forcontainment).
- Efficient query operations for finding nearby objects, measuringdistances, computing centroids, etc.
- A flexible and robust implementation of snap rounding (a geometrictechnique that allows operations to be implemented 100% robustlywhile using small and fast coordinate representations).
- A collection of efficient yet exact mathematical predicates fortesting relationships among geometric primitives.
- Extensive testing on Google’s vast collection of geographic data.
- Flexible Apache 2.0 license.
Table of Contents
About S2
Tutorials
Developer Guides
Resources