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
- CMake
- A C++ compiler with C++11 support, such as g++ >= 4.7.
- gflags command line flags
- glog logging module
- OpenSSL (for its bignums)
- googletest testing framework (to build tests, optional)
- A POSIX system (for getrusage).
On Ubuntu, all of these can be installed via apt-get:
sudo apt-get install cmake libgflags-dev libgoogle-glog-dev libgtest-dev openssl
Otherwise, you may need to install some from source.
On macOS, use MacPorts or
Homebrew. For MacPorts:
sudo port install cmake gflags google-glog openssl
. Do not install
gtest
from MacPorts; instead download release
1.8.0, unpack,
and run cmake
with -DGTEST_ROOT=.../googletest-release-1.8.0/googletest
.
Thorough testing has only been done on Ubuntu 14.04.3 and macOS 10.12.
mkdir s2-geometry-library
cd s2-geometry-library
tar zxvf $PATH_TO_DOWNLOADED_TGZ
mkdir build
cd build
cmake -DGTEST_ROOT=/usr/src/gtest .. # Omit -DGTEST_ROOT to skip tests.
make
make test # If GTEST_ROOT specified above.
sudo make install
This is not an official Google product.