{"id":20928,"library":"antimeridian","title":"Antimeridian","description":"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.","status":"active","version":"0.4.7","language":"python","source_language":"en","source_url":"https://github.com/gadomski/antimeridian","tags":["geojson","gis","antimeridian","geometry","180th-meridian","shapely"],"install":[{"cmd":"pip install antimeridian","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Geometry operations; used internally for splitting and validation.","package":"shapely","optional":false},{"reason":"Array operations for coordinate calculations.","package":"numpy","optional":false}],"imports":[{"note":"Top-level function; no more antimeridian.fix_geojson() needed; direct import recommended.","wrong":"import antimeridian","symbol":"fix_geojson","correct":"from antimeridian import fix_geojson"},{"note":"Lower-level function for single polygons.","symbol":"fix_polygon","correct":"from antimeridian import fix_polygon"}],"quickstart":{"code":"from antimeridian import fix_geojson\nimport json\n\ngeojson = {\n    \"type\": \"Polygon\",\n    \"coordinates\": [[\n        [179.0, -10.0],\n        [-179.0, -10.0],\n        [-179.0, 10.0],\n        [179.0, 10.0],\n        [179.0, -10.0]\n    ]]\n}\n\n# Fix the geometry\nfixed = fix_geojson(geojson)\nprint(json.dumps(fixed, indent=2))","lang":"python","description":"Correct a simple polygon crossing the antimeridian (180° longitude)."},"warnings":[{"fix":"Always assign the result: fixed = fix_geojson(original)","message":"fix_geojson returns a new dictionary; it does not modify the input in place. Do not assume mutation.","severity":"gotcha","affected_versions":"all"},{"fix":"Validate your GeoJSON structure before passing it. Wrap in try/except if needed.","message":"The function may raise InvalidGeometryError if the input is not a valid GeoJSON geometry object (e.g., missing 'type' or 'coordinates').","severity":"gotcha","affected_versions":"all"},{"fix":"Test your specific geometries after upgrading. Old behavior can't be restored.","message":"Version 0.4.0 changed the internal splitting algorithm, which may produce different output shapes for edge cases (e.g., geometries that touch the antimeridian).","severity":"breaking","affected_versions":">=0.4.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Wrap coordinates in a valid GeoJSON structure: {'type': 'Polygon', 'coordinates': your_list}","cause":"Passed a list of coordinates instead of a geometry dict.","error":"ValueError: Expected a GeoJSON geometry object, got list"},{"fix":"Only Polygon, MultiPolygon, and their derivatives (e.g., in a Feature) are supported. For other types, use other libraries or preprocess.","cause":"Attempted to fix a non-polygonal geometry type that antimeridian cannot handle.","error":"antimeridian.InvalidGeometryError: Geometry type not supported: LineString"},{"fix":"Use: fix_geojson(geometry_dict)","cause":"Called fix_geojson without arguments or with incorrect keyword.","error":"TypeError: fix_geojson() missing 1 required positional argument: 'geometry'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}