Fix GeoJSON geometries that cross the antimeridian
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
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:
pip install 'antimeridian[cli]'
antimeridian fix input.json > output.json
Developing
Clone and install in editable mode with the development optional dependencies:
git clone https://github.com/gadomski/antimeridian
cd antimeridian
pip install -e '.[dev,docs]'
We use pytest for tests:
pytest
We use Sphinx for docs:
make -C docs html
Contributing
Github issues and pull requests, please and thank you!
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.3.2.tar.gz
.
File metadata
- Download URL: antimeridian-0.3.2.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37b021fe50b8c5657cae150de28712543fd7adebbd5a0be3c7c1d777cd1959e1 |
|
MD5 | ec526fe8ea33fc13b96e69b6d659e7e2 |
|
BLAKE2b-256 | 7e01fa9f95e81cec8bad598ad165b606aab1089eaf669db631fa10c270a1e32b |
File details
Details for the file antimeridian-0.3.2-py3-none-any.whl
.
File metadata
- Download URL: antimeridian-0.3.2-py3-none-any.whl
- Upload date:
- Size: 13.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f87c8941e94142bb1a36daf8c63639597c02813908b4b36239490d2b70aca9b |
|
MD5 | d71c5243d9b76fe5d19c97c9a15f0eb6 |
|
BLAKE2b-256 | 3ae1d4373e3bb3030cd1dc3947da1f80711c21d70cf186bb2fd36eda7608e671 |