# google/s2geometry

Computational geometry and spatial indexing on the sphere

Repository: https://github.com/google/s2geometry
Canonical: https://ross.abutalabs.com/products/s2geometry
Homepage: http://s2geometry.io/
Language: C++
License: Apache-2.0
License Family: permissive
Topics: geometry, spherical-geometry, s2, spatial-indexing
Last push: 2026-08-25T00:06:33+00:00

## Health v2 (maintenance only)
Score: 84/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 56, longevity 100
- inputs: {"age_days": 3943, "days_push": 9, "days_rel": 132, "gap_med": 141, "n_releases_24m": 4}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2717, forks 355 (observed 2026-08-28T04:07:12.085244+00:00)

## What it is
S2 Geometry is a C++ library (with Python bindings) for computational geometry and spatial indexing on the sphere, representing geographic data on a 3D globe rather than flat map projections. It provides robust spatial indexes, constructive operations like intersection and union, and fast proximity queries over points, polylines, and polygons.

## Use cases
- index billions of geographic points for fast nearby queries
- find all points within 100km of a target location
- compute intersections and unions of polygons on the Earth's surface
- build a worldwide geographic database with no seams or singularities
- approximate arbitrary regions as collections of discrete S2 cells for distributed spatial indexes
- test whether a point is contained within a polygon
- measure distances and compute centroids of geographic shapes

## When to choose
- you need robust spherical geometry instead of flat 2D map projections
- you are building large-scale geographic or spatial databases
- you need fast in-memory spatial indexing of points, polylines, and polygons
- you need globally consistent spatial indexing without projection distortion or dateline seams
- you want a battle-tested library used extensively on Google's geographic data

## When to avoid
- you only need simple planar 2D geometry unrelated to the Earth's surface
- you need ellipsoidal (geodesic) precision, which is orders of magnitude slower
- you require a stable API or ABI - releases are 0.x with no stability guarantees
- you need first-class Windows support or a mature Pythonic API (the SWIG Python interface is unstable)

## Facets
- artifact type: library
- maturity: active
- function: search-engine, math, geospatial
- domain: databases, developer-tools
- platform: cpp, python, cross-platform
- tags: spherical-geometry, spatial-indexing, s2-cells, geospatial, computational-geometry, geographic-data, maps, algorithms, linux, macos

## Member repositories
- google/s2geometry (main) score 84

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:12.085244+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:15:20.245122+00:00, confidence not recorded.
  - readme: https://github.com/google/s2geometry (fetched 2026-08-28T04:07:12.085244+00:00, sha 4b88f9fcc0f3)
  - homepage: http://s2geometry.io/ (fetched 2026-08-29T09:58:20.885407+00:00, sha 7d8e976fc2e7)
  - site_page: https://s2geometry.io/about (fetched 2026-08-29T09:58:20.894582+00:00, sha 40d058e3da3d)
  - site_page: https://s2geometry.io/about/overview (fetched 2026-08-29T09:58:20.896368+00:00, sha f6c4d6a6010a)
  - site_page: https://s2geometry.io/devguide/cpp/quickstart (fetched 2026-08-29T09:58:20.898610+00:00, sha 8b19bccd8935)
  - site_page: https://s2geometry.io/about/platforms (fetched 2026-08-29T09:58:20.900703+00:00, sha 8cc57f337ed9)
- Data as of 2026-08-30T08:39:29.467469+00:00.
