Skip to main content

Correct GeoJSON geometries that cross the 180th meridian

Project description

antimeridian

CI Status Docs PyPI Conda Downloads GitHub Contributor Covenant

status DOI

Demonstration image

Fix shapes that cross the antimeridian. See the documentation for information about the underlying algorithm. Depends on shapely and numpy.

Can fix:

This repo has been ported to a few other languages:

Usage

python -m pip install antimeridian

Then:

import antimeridian

fixed = antimeridian.fix_geojson(geojson)

[!NOTE] fix_geojson mutates the input dictionary in-place. If you need to preserve the original GeoJSON, make a copy first:

import copy
fixed = antimeridian.fix_geojson(copy.deepcopy(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

Apache-2.0

Project details


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.4.8.tar.gz (12.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

antimeridian-0.4.8-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file antimeridian-0.4.8.tar.gz.

File metadata

  • Download URL: antimeridian-0.4.8.tar.gz
  • Upload date:
  • Size: 12.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for antimeridian-0.4.8.tar.gz
Algorithm Hash digest
SHA256 0ec6b84e083dceecdbcd73a88af4b860258dceda418c4147546b10c6c8b45b44
MD5 363967d26ab6482c7e3487734d966f38
BLAKE2b-256 1a33d11ef627eece463e8bc134da4ef2991311bdef1db26ba9b646c020a7a6d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for antimeridian-0.4.8.tar.gz:

Publisher: release-please.yaml on gadomski/antimeridian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file antimeridian-0.4.8-py3-none-any.whl.

File metadata

  • Download URL: antimeridian-0.4.8-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for antimeridian-0.4.8-py3-none-any.whl
Algorithm Hash digest
SHA256 a6764ddbfaed26edf95f2535632c3984edd98697202b9a5c7d2b9ae5da4a7771
MD5 59cdbef00eb4ace3e32ac943f640a901
BLAKE2b-256 2d34a6d9e709ae551f36bea13f66800c561b7f09d3b6cc607c4b9cfcd2e089ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for antimeridian-0.4.8-py3-none-any.whl:

Publisher: release-please.yaml on gadomski/antimeridian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page