Metadata-Version: 2.1
Name: antimeridian
Version: 0.3.3
Summary: Fix GeoJSON geometries that cross the antimeridian
Author-email: Pete Gadomski <pete.gadomski@gmail.com>
License: Apache-2.0
Project-URL: Documentation, https://antimeridian.readthedocs.io
Project-URL: Github, https://github.com/gadomski/antimeridan
Project-URL: Changelog, https://github.com/gadomski/antimeridian/blob/main/CHANGELOG.md
Keywords: geojson,antimeridian,shapely
Classifier: Programming Language :: Python :: 3
Classifier: Development Status :: 4 - Beta
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy (>=1.17.4)
Requires-Dist: shapely (>=2.0)
Provides-Extra: cli
Requires-Dist: click (~=8.1.6) ; extra == 'cli'
Provides-Extra: dev
Requires-Dist: blacken-docs (~=1.13) ; extra == 'dev'
Requires-Dist: black (~=23.3) ; extra == 'dev'
Requires-Dist: mypy (~=1.2) ; extra == 'dev'
Requires-Dist: packaging (~=23.1) ; extra == 'dev'
Requires-Dist: pre-commit (~=3.2) ; extra == 'dev'
Requires-Dist: pytest-console-scripts (~=1.3) ; extra == 'dev'
Requires-Dist: pytest (~=7.3) ; extra == 'dev'
Requires-Dist: ruff (==0.0.285) ; extra == 'dev'
Requires-Dist: typing-extensions ; (python_version < "3.10") and extra == 'dev'
Requires-Dist: tomli (~=2.0) ; (python_version < "3.11") and extra == 'dev'
Provides-Extra: docs
Requires-Dist: cartopy (~=0.21) ; extra == 'docs'
Requires-Dist: ipykernel (~=6.22) ; extra == 'docs'
Requires-Dist: jupytext (~=1.14) ; extra == 'docs'
Requires-Dist: nbsphinx (~=0.9) ; extra == 'docs'
Requires-Dist: pydata-sphinx-theme (~=0.13) ; extra == 'docs'
Requires-Dist: scipy (~=1.10.0) ; extra == 'docs'
Requires-Dist: sphinx-click (~=5.0) ; extra == 'docs'
Requires-Dist: sphinx (~=7.0) ; extra == 'docs'

# antimeridian

[![CI Status](https://img.shields.io/github/actions/workflow/status/gadomski/antimeridian/ci.yaml?style=for-the-badge&label=CI)](https://github.com/gadomski/antimeridian/actions/workflows/ci.yaml)
[![Read the Docs](https://img.shields.io/readthedocs/antimeridian?style=for-the-badge)](https://antimeridian.readthedocs.io/en/stable/)
[![PyPI](https://img.shields.io/pypi/v/antimeridian?style=for-the-badge)](https://pypi.org/project/antimeridian/)

[![GitHub](https://img.shields.io/github/license/gadomski/antimeridian?style=for-the-badge)](https://github.com/gadomski/antimeridian/blob/main/LICENSE)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg?style=for-the-badge)](https://github.com/gadomski/antimeridian/blob/main/CODE_OF_CONDUCT)

<img src="docs/img/complex-split.png" style="width: 600px;" alt="Demonstration image" />

Fix shapes that cross the antimeridian.
See [the documentation](https://antimeridian.readthedocs.io) for information about the underlying algorithm.
Depends on [shapely](https://shapely.readthedocs.io) and [numpy](https://numpy.org/).

Can fix:

- Shapely [`Polygon`](https://shapely.readthedocs.io/en/stable/reference/shapely.Polygon.html#shapely.Polygon), [`MultiPolygon`](https://shapely.readthedocs.io/en/stable/reference/shapely.MultiPolygon.html#shapely.MultiPolygon), [`LineString`](https://shapely.readthedocs.io/en/stable/reference/shapely.LineString.html#shapely.LineString), and [`MultiLineString`](https://shapely.readthedocs.io/en/stable/reference/shapely.MultiLineString.html#shapely.MultiLineString) objects
- GeoJSON [Polygons](https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.6), [MultiPolygons](https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.7), [Features](https://datatracker.ietf.org/doc/html/rfc7946#section-3.2) and [FeatureCollections](https://datatracker.ietf.org/doc/html/rfc7946#section-3.3), as dictionaries
- Anything that has a [`__geo_interface__`](https://gist.github.com/sgillies/2217756)

## Usage

```shell
pip install antimeridian
```

Then:

```python
import antimeridian

fixed = antimeridian.fix_geojson(geojson)
```

We also have some utilities to create [bounding boxes](https://antimeridian.readthedocs.io/en/latest/api.html#antimeridian.bbox) and [centroids](https://antimeridian.readthedocs.io/en/latest/api.html#antimeridian.centroid) from antimeridian-crossing polygons and multipolygons.
See [the documentation](https://antimeridian.readthedocs.io/) for a complete API reference.

### Command line interface

Use the `cli` optional dependency to install the `antimeridian` CLI:

```shell
pip install 'antimeridian[cli]'
antimeridian fix input.json > output.json
```

## Developing

Clone and install in editable mode with the development optional dependencies:

```shell
git clone https://github.com/gadomski/antimeridian
cd antimeridian
pip install -e '.[dev,docs]'
```

We use [pytest](https://docs.pytest.org) for tests:

```shell
pytest
```

We use [Sphinx](https://www.sphinx-doc.org) for docs:

```shell
make -C docs html
```

## Contributing

Github [issues](https://github.com/gadomski/antimeridian/issues) and [pull requests](https://github.com/gadomski/antimeridian/pulls), please and thank you!

## License

[Apache-2.0](https://github.com/gadomski/antimeridian/blob/main/LICENSE)
