☰ Menu
Home›Command-line Tools›s2geometry
CLI Open source 4 installs/mo

s2geometry for Mac

s2geometry

This is a package for manipulating geometric shapes. Unlike many geometry libraries, S2 is primarily designed to work with spherical geometry, i.e., shapes drawn on a sphere rather than on a planar 2D map.

s2geometry — overview

S2 Geometry Library

Overview

This is a package for manipulating geometric shapes. Unlike many geometry libraries, S2 is primarily designed to work with _spherical geometry_, i.e., shapes drawn on a sphere rather than on a planar 2D map. This makes it especially suitable for working with geographic data.

If you want to learn more about the library, start by reading the overview and quick start document, then read the introduction to the basic types.

S2 documentation can be found on s2geometry.io.

API/ABI Stability

Note that all releases are version 0.x, so there are no API or ABI stability guarantees. Starting with 1.0 we will adhere to SemVer and follow the

The Python API is particularly unstable, and it is planned that the SWIGged API will be replaced by a pybind11 version with more Pythonic names and more complete functionality.

Requirements for End Users using Bazel

Build

This bazel build requires Bazel 8 or newer. Builds were tested using C++20 as set in .bazelrc. This setup relies on abseil-cpp and googletest from the bazel central repository as set in MODULE.bazel.

To build and test using bazel, from within s2geometry/src, run:

bazel test "//:"

To build the libary without testing, from within s2geometry/src, run:

bazel build //:s2

Status

All tests enumerated in the BUILD.bazel file pass on x86 machines. On Apple M1, s2loop_measures_test fails due to a 6% excess accumlated error. This issue may require revision of boringssl or exactfloat.

Requirements for End Users using CMake

We aim to support all platforms supported by the

CMake >= 3.22 A C++ compiler with C++17 support, such as g++ >= 7.5 or

Abseil LTS

(standard library extensions). This exact version must be used. googletest testing framework >= 1.10 (to build tests and example programs, optional) OpenSSL (for its bignum library)

On Ubuntu, all of these other than abseil can be installed via apt-get:

abseil-cpp may need to be installed from source if an LTS release is not packaged for the platform. See the use of -DCMAKE_PREFIX_PATH in the build instructions below.

On macOS, use MacPorts or Homebrew. For MacPorts:

Build and Install

You may either download the source as a ZIP archive, or clone the git repository.

Via ZIP archive

Download ZIP file

Via git clone

Building

First, install Abseil. It must be configured with -DCMAKE_POSITION_INDEPENDENT_CODE=ON. s2geometry must be configured to use the same C++ version that abseil uses. The easiest way to achieve this is to pass -DCMAKE_CXX_STANDARD=17 to cmake when compiling both abseil and s2geometry.

From the appropriate directory depending on how you got the source:

On macOS, sysctl -n hw.logicalcpu is the equivalent of nproc.

Disable building of shared libraries with -DBUILD_SHARED_LIBS=OFF.

Enable the python interface with -DWITH_PYTHON=ON.

For Testing

If BUILD_TESTS is 'on' (the default), then OpenSSL must be available to build some tests:

OpenSSL (for its bignum library)

Details

球体上的计算几何与空间索引

How to install s2geometry

  1. Open Terminal (press ⌘ + Space and type “Terminal”).
  2. If Homebrew is not installed yet, run the command below first.
  3. Run this command:

Latest 10 releases

Last updated 2026-04-23; current version v0.14.0, with the latest 10 releases listed.

VersionReleasedTypeSizemacOSWindowsLinux
v0.14.02026-04-23Stable————
v0.13.12025-12-03Stable————
v0.13.02025-12-01Stable————
v0.12.02025-02-17Stable————
v0.11.12024-02-03Stable————
v0.11.02024-01-27Stable————
v0.10.02022-04-08Stable————
v0.9.02019-03-05Stable————
v0.10.0-2022.02.23.002022-02-23Pre-release————
v0.9.0-2019.03.04.002019-03-04Pre-release————

Data from GitHub Releases; stable releases first, each group sorted newest first.

Prebuilt bottle platforms

Official Homebrew bottles cover:

  • Apple silicon · latest macOS
  • Apple silicon · macOS 26 Tahoe
  • Apple silicon · macOS 15 Sequoia
  • Apple silicon · macOS 14 Sonoma
  • Intel · macOS 14 Sonoma
  • Linux · ARM64
  • Linux · x86_64

Compared with similar apps

Only public metadata is compared, with no subjective recommendation; see the compare pages for field-by-field comparisons.

Compared with similar apps
AppVersionLicenseArchitecture30-day installs
s2geometryv0.14.0Apache-2.0CLI4
h3v4.5.0Apache-2.0CLI8
ngtv2.8.1Apache-2.0CLI1
tile381.38.0MITCLI3

Similar apps: Command-line Tools

Leave a comment

评论表单加载中…