Correct 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
To build and serve the docs locally:
uv run mkdocs serve
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
Built Distribution
File details
Details for the file antimeridian-0.4.1.tar.gz
.
File metadata
- Download URL: antimeridian-0.4.1.tar.gz
- Upload date:
- Size: 12.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
4efe7aa15ef1bc66169392870d54b945c31ef9574e08bc930650f0b7beefc354
|
|
MD5 |
1e5353a216c06dcdb4ceadd6d4e6c99f
|
|
BLAKE2b-256 |
de4fb83d7ea4ee0ff64fa36906f82d6f2c227aa36828481f60eafbf320dea6c1
|
Provenance
The following attestation bundles were made for antimeridian-0.4.1.tar.gz
:
Publisher:
release.yaml
on gadomski/antimeridian
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
antimeridian-0.4.1.tar.gz
-
Subject digest:
4efe7aa15ef1bc66169392870d54b945c31ef9574e08bc930650f0b7beefc354
- Sigstore transparency entry: 194953810
- Sigstore integration time:
-
Permalink:
gadomski/antimeridian@a8a3b76f7e1cc74caf14278896a5e2179be4a1cd
-
Branch / Tag:
refs/tags/v0.4.1
- Owner: https://github.com/gadomski
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
release.yaml@a8a3b76f7e1cc74caf14278896a5e2179be4a1cd
-
Trigger Event:
push
-
Statement type:
File details
Details for the file antimeridian-0.4.1-py3-none-any.whl
.
File metadata
- Download URL: antimeridian-0.4.1-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
45c31d5fc834863175a1d20b522c1da941edb906dfd84a05fae5007985efe405
|
|
MD5 |
863043e40cdcfcce690e4e49a5884841
|
|
BLAKE2b-256 |
107a12dcb24f69cb8fb8b65b810d9590038b06c528f5b57c6db9bfaecc7121e0
|
Provenance
The following attestation bundles were made for antimeridian-0.4.1-py3-none-any.whl
:
Publisher:
release.yaml
on gadomski/antimeridian
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
antimeridian-0.4.1-py3-none-any.whl
-
Subject digest:
45c31d5fc834863175a1d20b522c1da941edb906dfd84a05fae5007985efe405
- Sigstore transparency entry: 194953813
- Sigstore integration time:
-
Permalink:
gadomski/antimeridian@a8a3b76f7e1cc74caf14278896a5e2179be4a1cd
-
Branch / Tag:
refs/tags/v0.4.1
- Owner: https://github.com/gadomski
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
release.yaml@a8a3b76f7e1cc74caf14278896a5e2179be4a1cd
-
Trigger Event:
push
-
Statement type: