{"id":13590949,"url":"https://github.com/google/s2geometry","last_synced_at":"2025-05-13T19:02:22.081Z","repository":{"id":37431670,"uuid":"46291330","full_name":"google/s2geometry","owner":"google","description":"Computational geometry and spatial indexing on the sphere","archived":false,"fork":false,"pushed_at":"2025-05-05T19:34:39.000Z","size":10766,"stargazers_count":2447,"open_issues_count":55,"forks_count":328,"subscribers_count":69,"default_branch":"master","last_synced_at":"2025-05-05T20:42:59.750Z","etag":null,"topics":["geometry","s2","spatial-indexing","spherical-geometry"],"latest_commit_sha":null,"homepage":"http://s2geometry.io/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/google.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-11-16T17:41:03.000Z","updated_at":"2025-05-05T19:34:45.000Z","dependencies_parsed_at":"2023-02-09T15:45:22.380Z","dependency_job_id":"58e3b213-dd35-47ef-b43d-110f5b6db01f","html_url":"https://github.com/google/s2geometry","commit_stats":{"total_commits":510,"total_committers":31,"mean_commits":"16.451612903225808","dds":"0.11960784313725492","last_synced_commit":"418c55893f6123b90f2768ed2ec9f5f47fa512de"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fs2geometry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fs2geometry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fs2geometry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fs2geometry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/google","download_url":"https://codeload.github.com/google/s2geometry/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254010790,"owners_count":21998993,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geometry","s2","spatial-indexing","spherical-geometry"],"created_at":"2024-08-01T16:00:52.105Z","updated_at":"2025-05-13T19:02:21.963Z","avatar_url":"https://github.com/google.png","language":"C++","funding_links":[],"categories":["C++","Geospatial Library","Libraries"],"sub_categories":["C++"],"readme":"# S2 Geometry Library\n\n## Overview\n\nThis is a package for manipulating geometric shapes. Unlike many geometry\nlibraries, S2 is primarily designed to work with _spherical geometry_, i.e.,\nshapes drawn on a sphere rather than on a planar 2D map. This makes it\nespecially suitable for working with geographic data.\n\nIf you want to learn more about the library, start by reading the\n[overview](http://s2geometry.io/about/overview) and [quick start\ndocument](http://s2geometry.io/devguide/cpp/quickstart), then read the\nintroduction to the [basic types](http://s2geometry.io/devguide/basic_types).\n\nS2 documentation can be found on [s2geometry.io](http://s2geometry.io).\n\n## API/ABI Stability\n\nNote that all [releases](https://github.com/google/s2geometry/releases) are\nversion 0.x, so there are\n[no API or ABI stability guarantees](https://semver.org/#spec-item-4).\nStarting with 1.0 we will adhere to [SemVer](https://semver.org/).\n\nThe Python API is particularly unstable, and it is planned that the SWIGged\nAPI will be replaced by a pybind11 version with more Pythonic names and more\ncomplete functionality.\n\n## Requirements for End Users using Bazel\n\n## Build\n\nThis bazel build requires 7.0.0 – bzlmod default. Builds were tested using \nC++20 as set in .bazelrc. This setup relies on abseil-cpp, boringssl, and \ngoogletest from the bazel central repository as set in MODULE.bazel.\n\nTo build and test using bazel, from within s2geometry/src, run:\n\n`bazel test \"//:*\"`\n\nTo build the libary without testing, from within s2geometry/src, run:\n\n`bazel build //:s2`\n\n## Status\n\nAll tests enumerated in the BUILD.bazel file pass on x86 machines. On \nApple M1, s2loop_measures_test fails due to a 6% excess accumlated error. \nThis issue may require revision of boringssl or exactfloat.\n\n## Requirements for End Users using CMake\n\n*   [CMake](http://www.cmake.org/) \u003e= 3.5\n*   A C++ compiler with C++14 support, such as [g++ \u003e= 5](https://gcc.gnu.org/)\n*   [Abseil](https://github.com/abseil/abseil-cpp) \u003e= LTS\n    [`20240722`](https://github.com/abseil/abseil-cpp/releases/tag/20240722.0)\n    (standard library extensions)\n*   [OpenSSL](https://github.com/openssl/openssl) (for its bignum library)\n*   [googletest testing framework \u003e= 1.10](https://github.com/google/googletest)\n    (to build tests and example programs, optional)\n\nOn Ubuntu, all of these other than abseil can be installed via apt-get:\n\n```\nsudo apt-get install cmake googletest libssl-dev\n```\n\nabseil-cpp may need to be installed from source if an LTS release is not\npackaged for the platform.  See the use of `-DCMAKE_PREFIX_PATH` in the\n[build instructions below](#building).\n\nOn macOS, use [MacPorts](http://www.macports.org/) or\n[Homebrew](http://brew.sh/).  For MacPorts:\n\n```\nsudo port install cmake abseil gtest openssl\n```\n\nthen use\n\n```\ncmake -DGOOGLETEST_ROOT=/opt/local/src -DCMAKE_PREFIX_PATH=/opt/local ..\n```\n\nin the build instructions below.\n\nThorough testing has only been done on Ubuntu 14.04.3 and macOS 10.13.\n\n## Build and Install\n\nYou may either download the source as a ZIP archive, or [clone the git\nrepository](https://help.github.com/articles/cloning-a-repository/).\n\n### Via ZIP archive\n\nDownload [ZIP file](https://github.com/google/s2geometry/archive/master.zip)\n\n```\ncd [parent of directory where you want to put S2]\nunzip [path to ZIP file]/s2geometry-master.zip\ncd s2geometry-master\n```\n\n### Via `git clone`\n\n```\ncd [parent of directory where you want to put S2]\ngit clone https://github.com/google/s2geometry.git\ncd s2geometry\n```\n\n### Building\n\nFirst, [install Abseil](https://github.com/abseil/abseil-cpp/blob/master/CMake/README.md#traditional-cmake-set-up).\nIt must be configured with `-DCMAKE_POSITION_INDEPENDENT_CODE=ON`.\ns2geometry must be configured to use the same C++ version that\nabseil uses.  The easiest way to achieve this is to pass\n`-DCMAKE_CXX_STANDARD=14` (or `-DCMAKE_CXX_STANDARD=17`) to `cmake`\nwhen compiling both abseil and s2geometry.\n\nFrom the appropriate directory depending on how you got the source:\n\n```\nmkdir build\ncd build\n# You can omit -DGOOGLETEST_ROOT to skip tests; see above for macOS.\n# Use the same CMAKE_CXX_STANDARD value that was used with absl.\ncmake -DGOOGLETEST_ROOT=/usr/src/googletest -DCMAKE_PREFIX_PATH=/path/to/absl/install -DCMAKE_CXX_STANDARD=14 ..\nmake -j $(nproc)\nmake test ARGS=\"-j$(nproc)\"  # If GOOGLETEST_ROOT specified above.\nsudo make install\n```\n\nOn macOS, `sysctl -n hw.logicalcpu` is the equivalent of `nproc`.\n\nDisable building of shared libraries with `-DBUILD_SHARED_LIBS=OFF`.\n\nEnable the python interface with `-DWITH_PYTHON=ON`.\n\nIf OpenSSL is installed in a non-standard location set `OPENSSL_ROOT_DIR`\nbefore running configure, for example on macOS:\n```\nOPENSSL_ROOT_DIR=/opt/homebrew/Cellar/openssl@3/3.1.0 cmake -DCMAKE_PREFIX_PATH=/opt/homebrew -DCMAKE_CXX_STANDARD=17\n```\n\n## Installing\n\nFrom `build` subdirectory:\n\n```\nmake install\n```\n\nPrefix it with `sudo` if needed:\n\n```\nsudo make install\n```\n\n_NOTE_: There is not `uninstall` target but `install_manifest.txt` may be helpful.\n\nAll files will be installed at location specified in `CMAKE_INSTALL_PREFIX` variable.\n\nSeveral suffix variables used for some file groups:\n\nVariable | Default | Description\n-------- | ------- | -----------\n`CMAKE_INSTALL_INCLUDEDIR` | `include` | For header files\n`CMAKE_INSTALL_BINDIR`     | `bin`     | For executables and `*.dll` files on `DLL`-based platforms\n`CMAKE_INSTALL_LIBDIR`     | `lib`     | For library files (`*.so`, `*.a`, `*.lib` etc)\n\nIf needed set this variables on command line as `cmake` arguments with `-D` prefix or edit from `build` subdirectory:\n\n```\nmake edit_cache\n```\n\nFor more info read: [The CMake Cache](https://cmake.org/cmake/help/latest/guide/user-interaction/index.html#the-cmake-cache).\n\n## Python\n\nIf you want the Python interface, you need to run cmake using\n`-DWITH_PYTHON=ON`. You will also need to install the following dependencies:\n\n* [SWIG 4](https://github.com/swig/swig) (for Python support, optional)\n* python3-dev (for Python support, optional)\n\nwhich can be installed via\n\n```\nsudo apt-get install swig python3-dev\n```\n\nor on macOS:\n\n```\nsudo port install swig\n```\nVersion 4.0 is required, but it should be easy to make it work 3.0 or probably\neven 2.0.\n\nPython 3 is required.\n\n### Creating wheels\nFirst, make a virtual environment and install `build` into it:\n```\npython3 -m venv venv\nsource venv/bin/activate\npip install build\n```\n\nThen build the wheel:\n```\npython -m build\n```\n\nThe resulting wheel will be in the `dist` directory.\n\n\u003e If OpenSSL is in a non-standard location make sure to set `OPENSSL_ROOT_DIR`; \n\u003e see above for more information.\n\n## Other S2 implementations\n\n* [Go](https://github.com/golang/geo) (Approximately 40% complete.)\n* [Java](https://github.com/google/s2-geometry-library-java)\n* [Kotlin](https://github.com/Enovea/s2-geometry-kotlin) (Complete except binary serialization)\n\n## Disclaimer\n\nThis is not an official Google product.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Fs2geometry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogle%2Fs2geometry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Fs2geometry/lists"}