skillfed

s2sphere

Python implementation of the S2 Geometry Library

s2sphere v0.2.5 413.7K downloads/30d#6,841 on PyPI
Permissive license MIT Abandoned released

What it is and what it does

s2sphere is a Python implementation of part of the C++ S2 geometry library, a system for hierarchical spatial indexing and geometric calculations on a sphere. It lets you work with geographic coordinates, compute distances, and organize points and regions into a discrete cell hierarchy that covers the Earth's surface. The library is useful for spatial queries, geographic clustering, and location-based services that need efficient indexing without the overhead of a full GIS system.

The package has no runtime dependencies and installs as a pure Python wheel, making setup simple. However, it has been abandoned since 2017-11-16 and receives no maintenance, security updates, or compatibility fixes. The classifiers indicate support only for Python 2.7 and Python 3.4, 3.5, which are themselves end-of-life; whether the code actually runs on modern Python versions is untested.

Use it for:

  • Index geographic points into an S2 cell hierarchy for fast spatial lookups and clustering.
  • Compute distances and geometric relationships between locations on Earth without a full GIS library.
  • Build location-based services that need efficient hierarchical spatial partitioning.
  • Analyze geographic data where you need cell-level aggregation or region coverage queries.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

s2sphere provides Python bindings to work with S2 geometry—a spherical geometry library for spatial indexing and geometric calculations on the Earth's surface.

Yes, if you need S2 geometry and have confirmed it works on your Python version. The permissive MIT license and zero runtime dependencies make it low-risk to try. However, abandonment since 2017-11-16 means no bug fixes, security patches, or compatibility updates are forthcoming—verify it runs on your target Python version before committing to it in production.

Install

s2sphere on PyPI

pip

pip install s2sphere

uv

uv add s2sphere

poetry

poetry add s2sphere

Installing s2sphere

Before you install

Installation is frictionless (pure Python wheel), but the package is abandoned—last release was 2017-11-16, over 3193 days ago. No active maintenance or security updates should be expected.

License in practice

MIT license is permissive; you can use, modify, and distribute s2sphere freely in commercial and private projects with minimal restrictions.

Quickstart

pip install s2sphere

from s2sphere import CellId, LatLng

# Create a cell from latitude/longitude
latlng = LatLng.from_degrees(latitude, longitude)
cell = CellId.from_lat_lng(latlng)

Package classifiers indicate Python 2.7 and Python 3.4, 3.5 support; compatibility with modern Python versions is unverified.

Verify before relying

  • Whether s2sphere works correctly on Python versions beyond 3.5 despite no recent maintenance.
  • Whether the package's S2 geometry implementation matches the current upstream C++ S2 library behavior.
  • Performance characteristics and scalability limits for large spatial datasets.

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance abandoned — 3,193 days since the last release
First released
Downloads 413,665/month — #6,841 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: s2sphere-0.2.5-py2.py3-none-any.whl

Development Status :: 4 - BetaIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5

Tags

spherical geometry libraryS2 geometry pythonspatial indexing earthgeographic coordinate geometryearth surface geometryS2 cell hierarchiesspatial cells
spatial-indexinggeometryabandoned

More Mathematics packages