compactnesslib is meant to be a performant library for calculating compactness metrics of multipolygons, especially electoral districts.
To use as a library, include compactnesslib in your project's CMakeLists.txt
file:
add_subdirectory(compactnesslib)
Then include the library in your code using:
#include <compactnesslib/compactnesslib.hpp>
To run tests build using:
mkdir build
cd build
cmake ..
make unittest
A list of the available compactness scores and how they are calculated is available here.
compactnesslib assumes that you have appropriately projected your data to a Euclidean plane prior to performing any calculations on it.
compactnesslib is a core component of the Python package python-mander and the R package mandeR.
This package was created for the Metric Geometry And Gerrymandering Group as part of a hack-a-thon on August 10-11, 2017.