Fix GeoJSON geometries that cross the 180th meridian
Project description
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
We use Sphinx for docs:
make -C docs html
Contributing
See CONTRIBUTING.md.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
antimeridian-0.3.11.tar.gz
(10.1 MB
view details)
Built Distribution
File details
Details for the file antimeridian-0.3.11.tar.gz
.
File metadata
- Download URL: antimeridian-0.3.11.tar.gz
- Upload date:
- Size: 10.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fde0134e6799676ec68765d3e588f5f32cabd4041b1f969b923758d0a6cd0c7f |
|
MD5 | 57f51ef14eff8ae307de962a0c487927 |
|
BLAKE2b-256 | f2427bddf42ea25e5e682aea63b76326d09cedb1b3f28cc4a9cf680a271ae3fc |
File details
Details for the file antimeridian-0.3.11-py3-none-any.whl
.
File metadata
- Download URL: antimeridian-0.3.11-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c08efe55de11338235d21920d49bacbc63fe369d3f23c6e00d9cf08b052ede1 |
|
MD5 | 6198625617dfcf5200ac5051f114e3bf |
|
BLAKE2b-256 | f5e3a1ce92c9082936d0b58dba6e74a980c0b9eef2714bd3f4a988a7bfd4ec65 |