Fix shapes that cross the antimeridian. See the documentation for information about the underlying algorithm. Depends on shapely and numpy.
Can fix:
Polygon
, MultiPolygon
, LineString
, and MultiLineString
objects__geo_interface__
python -m pip install antimeridian
Then:
import antimeridian
fixed = antimeridian.fix_geojson(geojson)
We also have some utilities to create bounding boxes and centroids from antimeridian-crossing polygons and multipolygons. See the documentation for a complete API reference.
Use the cli
optional dependency to install the antimeridian
CLI:
python -m pip install 'antimeridian[cli]'
antimeridian fix input.json > output.json
Get uv. Then:
git clone https://github.com/gadomski/antimeridian
cd antimeridian
uv sync
We use pytest for tests:
uv run pytest
We use Sphinx for docs:
make -C docs html
See CONTRIBUTING.md.