Registry / data / antimeridian

antimeridian

JSON →
library0.4.7pypypi✓ verified 85d ago

Corrects GeoJSON geometries (Polygons, MultiPolygons, etc.) that cross the 180th meridian (antimeridian). Splits them into valid, non-wrapping geometries. Current version: 0.4.7. Release cadence: infrequent, as needed.

pip install antimeridian
INSTALL
IMPORT
SIG · ANTIMERIDIAN
A
antimeridian
datapythonv0.4.7
Install
4.0s avg
Import
302ms
Disk
101MB
Pass rate
9/ 10
Env Coverage9 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.4.7 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 4.2s
py 3.11
✓ —
✓ 3.8s
py 3.12
✓ —
✓ 3.7s
py 3.13
✓ —
✓ 3.6s
py 3.9
✕ build_error
✓ 4.6s
101MB installed
● package 101MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

fix_geojson
from antimeridian import fix_geojson
import antimeridian
Top-level function; no more antimeridian.fix_geojson() needed; direct import recommended.
fix_polygon
from antimeridian import fix_polygon
Lower-level function for single polygons.

Correct a simple polygon crossing the antimeridian (180° longitude).

from antimeridian import fix_geojson import json geojson = { "type": "Polygon", "coordinates": [[ [179.0, -10.0], [-179.0, -10.0], [-179.0, 10.0], [179.0, 10.0], [179.0, -10.0] ]] } # Fix the geometry fixed = fix_geojson(geojson) print(json.dumps(fixed, indent=2))
Debug
Known issues
gotchafix_geojson returns a new dictionary; it does not modify the input in place. Do not assume mutation.
fix
Always assign the result: fixed = fix_geojson(original)
affects: all
gotchaThe function may raise InvalidGeometryError if the input is not a valid GeoJSON geometry object (e.g., missing 'type' or 'coordinates').
fix
Validate your GeoJSON structure before passing it. Wrap in try/except if needed.
affects: all
breakingVersion 0.4.0 changed the internal splitting algorithm, which may produce different output shapes for edge cases (e.g., geometries that touch the antimeridian).
fix
Test your specific geometries after upgrading. Old behavior can't be restored.
affects: >=0.4.0
Errors
Common errors & fixes
ValueError: Expected a GeoJSON geometry object, got list
Passed a list of coordinates instead of a geometry dict.
fix
Wrap coordinates in a valid GeoJSON structure: {'type': 'Polygon', 'coordinates': your_list}
antimeridian.InvalidGeometryError: Geometry type not supported: LineString
Attempted to fix a non-polygonal geometry type that antimeridian cannot handle.
fix
Only Polygon, MultiPolygon, and their derivatives (e.g., in a Feature) are supported. For other types, use other libraries or preprocess.
TypeError: fix_geojson() missing 1 required positional argument: 'geometry'
Called fix_geojson without arguments or with incorrect keyword.
fix
Use: fix_geojson(geometry_dict)
Upgrade
Version history
0.4.7latest on PyPI · released Apr 3, 2026
Audit
Dependencies
shapelyrequiredGeometry operations; used internally for splitting and validation.
numpyrequiredArray operations for coordinate calculations.
Agent activity
36 hits · last 30 days
node
28
OpenAI (training)
1
Resources
antimeridian — pip install antimeridian · libregistry