Correct GeoJSON geometries that cross the 180th meridian
Project Links
Meta
Author: Pete Gadomski
Requires Python: >=3.10
Classifiers
Development Status
- 4 - Beta
Programming Language
- Python :: 3
- Python :: 3.10
- Python :: 3.11
- Python :: 3.12
- Python :: 3.13
antimeridian
Fix shapes that cross the antimeridian. See the documentation for information about the underlying algorithm. Depends on shapely and numpy.
Can fix:
- Shapely
Polygon
,MultiPolygon
,LineString
, andMultiLineString
objects - GeoJSON Polygons, MultiPolygons, Features and FeatureCollections, as dictionaries
- Anything that has a
__geo_interface__
Usage
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.
Command line interface
Use the cli
optional dependency to install the antimeridian
CLI:
python -m pip install 'antimeridian[cli]'
antimeridian fix input.json > output.json
Developing
Get uv. Then:
git clone https://github.com/gadomski/antimeridian
cd antimeridian
uv sync
We use pytest for tests:
uv run pytest
To build and serve the docs locally:
uv run mkdocs serve
Contributing
See CONTRIBUTING.md.
License
Apr 10, 2025
0.4.1
Dec 18, 2024
0.4.0
Dec 09, 2024
0.3.12
Oct 17, 2024
0.3.11
Oct 17, 2024
0.3.10
Oct 12, 2024
0.3.9
Jul 11, 2024
0.3.8
Jun 20, 2024
0.3.7
May 16, 2024
0.3.6
May 05, 2024
0.3.5
Mar 29, 2024
0.3.4
Aug 21, 2023
0.3.3
Aug 21, 2023
0.3.2
Jul 10, 2023
0.3.1
Jun 29, 2023
0.3.0
May 31, 2023
0.2.6
May 31, 2023
0.2.5
May 12, 2023
0.2.4
Apr 28, 2023
0.2.3
Apr 28, 2023
0.2.2
Apr 28, 2023
0.2.1
Apr 26, 2023
0.2.0
Apr 18, 2023
0.1.0
Apr 14, 2023
0.0.2.post0
Apr 14, 2023
0.0.2
Apr 14, 2023
0.0.1.post1
Apr 14, 2023
0.0.1.post0
Apr 14, 2023
0.0.1