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.7.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.7-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for antimeridian-0.4.7.tar.gz
Algorithm Hash digest
SHA256 ae1ee613ddec6bf1bec35ee89d49baed03341e0c295b26f4c1dca3b36fff9698
MD5 fd32aab29d91a3b2ecaba3d400b2f9f2
BLAKE2b-256 d9cae196bc600c4c45a7be7194eed393a2b05d3dc30f0e5c07b92ceb85414c2a

See more details on using hashes here.

Provenance

The following attestation bundles were made for antimeridian-0.4.7.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.7-py3-none-any.whl.

File metadata

  • Download URL: antimeridian-0.4.7-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.7

File hashes

Hashes for antimeridian-0.4.7-py3-none-any.whl
Algorithm Hash digest
SHA256 fedc04d5460ee9f05e37e7adc335843538fbd911c2bf7bd36c5393cd4ffe107d
MD5 ef6241f0eea9fad0159860b0a40e6395
BLAKE2b-256 50ccf1f8a798820dfa339f8321e3b92f5cda38b0e4b2a0bd38f9d7a64bca26ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for antimeridian-0.4.7-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