[Git][debian-gis-team/antimeridian][upstream] New upstream version 0.4.3
Antonio Valentino (@antonio.valentino)
gitlab at salsa.debian.org
Sun Aug 10 15:41:17 BST 2025
Antonio Valentino pushed to branch upstream at Debian GIS Project / antimeridian
Commits:
f5510165 by Antonio Valentino at 2025-08-08T05:48:27+00:00
New upstream version 0.4.3
- - - - -
14 changed files:
- .github/workflows/ci.yaml
- .github/workflows/docs.yaml
- .pre-commit-config.yaml
- CHANGELOG.md
- pyproject.toml
- src/antimeridian/_implementation.py
- + tests/data/input/issues-171.json
- + tests/data/input/issues-174.json
- + tests/data/output/flat/issues-171.json
- + tests/data/output/flat/issues-174.json
- + tests/data/output/spherical/issues-171.json
- + tests/data/output/spherical/issues-174.json
- tests/test_polygon.py
- uv.lock
Changes:
=====================================
.github/workflows/ci.yaml
=====================================
@@ -26,7 +26,7 @@ jobs:
- uses: actions/setup-python at v5
with:
python-version: ${{ matrix.python-version }}
- - uses: astral-sh/setup-uv at v5
+ - uses: astral-sh/setup-uv at v6
- name: Sync
run: uv sync
- name: pre-commit
@@ -43,7 +43,7 @@ jobs:
uses: actions/setup-python at v5
with:
python-version: "3.10"
- - uses: astral-sh/setup-uv at v5
+ - uses: astral-sh/setup-uv at v6
- name: Sync
run: uv sync --resolution lowest-direct
- name: pytest
=====================================
.github/workflows/docs.yaml
=====================================
@@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout at v4
with:
fetch-depth: 0
- - uses: astral-sh/setup-uv at v5
+ - uses: astral-sh/setup-uv at v6
- name: Sync
run: uv sync
- name: Deploy
=====================================
.pre-commit-config.yaml
=====================================
@@ -6,14 +6,14 @@ repos:
- id: end-of-file-fixer
- id: check-yaml
- repo: https://github.com/pre-commit/mirrors-mypy
- rev: v1.15.0
+ rev: v1.17.0
hooks:
- id: mypy
additional_dependencies:
- click~=8.1.6
- pytest>=8.0
- repo: https://github.com/charliermarsh/ruff-pre-commit
- rev: v0.11.4
+ rev: v0.12.5
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
=====================================
CHANGELOG.md
=====================================
@@ -6,6 +6,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
## [Unreleased]
+## [0.4.3] - 2025-07-25
+
+### Fixed
+
+- Too-aggressive `isclose` for points close to the antimeridian ([#175](https://github.com/gadomski/antimeridian/pull/175))
+
+## [0.4.2] - 2025-07-14
+
+### Fixed
+
+- Multiple interiors ([#172](https://github.com/gadomski/antimeridian/pull/172))
+
## [0.4.1] - 2025-04-10
### Added
@@ -187,7 +199,9 @@ This v0.1.0 release is to indicate that we think that this package is ready to u
Initial release.
-[unreleased]: https://github.com/gadomski/antimeridian/compare/v0.4.1...HEAD
+[unreleased]: https://github.com/gadomski/antimeridian/compare/v0.4.3...HEAD
+[0.4.3]: https://github.com/gadomsk/antimeridian/compare/v0.4.2...v0.4.3
+[0.4.2]: https://github.com/gadomsk/antimeridian/compare/v0.4.1...v0.4.2
[0.4.1]: https://github.com/gadomsk/antimeridian/compare/v0.4.0...v0.4.1
[0.4.0]: https://github.com/gadomsk/antimeridian/compare/v0.3.12...v0.4.0
[0.3.12]: https://github.com/gadomsk/antimeridian/compare/v0.3.11...v0.3.12
=====================================
pyproject.toml
=====================================
@@ -1,6 +1,6 @@
[project]
name = "antimeridian"
-version = "0.4.1"
+version = "0.4.3"
authors = [{ name = "Pete Gadomski", email = "pete.gadomski at gmail.com" }]
description = "Correct GeoJSON geometries that cross the 180th meridian"
readme = "README.md"
=====================================
src/antimeridian/_implementation.py
=====================================
@@ -10,6 +10,7 @@ from __future__ import annotations
import copy
import itertools
+import math
import warnings
from collections import namedtuple
from typing import Any, Dict, List, Optional, Protocol, Tuple, Union, cast
@@ -468,12 +469,15 @@ def fix_polygon_to_list(
polygons = build_polygons(segments)
assert polygons
for i, polygon in enumerate(polygons):
- for j, interior in enumerate(interiors):
+ new_interiors = []
+ for interior in interiors:
if polygon.contains(interior):
- interior = interiors.pop(j)
polygon_interiors = list(polygon.interiors)
polygon_interiors.append(interior)
polygons[i] = Polygon(polygon.exterior, polygon_interiors)
+ else:
+ new_interiors.append(interior)
+ interiors = new_interiors
assert not interiors
return polygons
@@ -484,7 +488,7 @@ def normalize(coords: List[XY]) -> List[XY]:
for i, point in enumerate(coords):
# Ensure all longitudes are between -180 and 180, and that tiny floating
# point differences are ignored.
- if numpy.isclose(point[0], 180):
+ if math.isclose(point[0], 180):
# https://github.com/gadomski/antimeridian/issues/81
if abs(coords[i][1]) != 90 and numpy.isclose(
coords[(i - 1) % len(coords)][0], -180
@@ -492,7 +496,7 @@ def normalize(coords: List[XY]) -> List[XY]:
coords[i] = (-180, point[1])
else:
coords[i] = (180, point[1])
- elif numpy.isclose(point[0], -180):
+ elif math.isclose(point[0], -180):
# https://github.com/gadomski/antimeridian/issues/81
if abs(coords[i][1]) != 90 and numpy.isclose(
coords[(i - 1) % len(coords)][0], 180
=====================================
tests/data/input/issues-171.json
=====================================
@@ -0,0 +1,91 @@
+{
+ "type": "Polygon",
+ "coordinates": [
+ [
+ [
+ -160,
+ 80
+ ],
+ [
+ -120,
+ 80
+ ],
+ [
+ -80,
+ 80
+ ],
+ [
+ -40,
+ 80
+ ],
+ [
+ 0,
+ 80
+ ],
+ [
+ 40,
+ 80
+ ],
+ [
+ 80,
+ 80
+ ],
+ [
+ 120,
+ 80
+ ],
+ [
+ 160,
+ 80
+ ],
+ [
+ -160,
+ 80
+ ]
+ ],
+ [
+ [
+ 0,
+ 81
+ ],
+ [
+ -1,
+ 82
+ ],
+ [
+ 0,
+ 83
+ ],
+ [
+ 1,
+ 82
+ ],
+ [
+ 0,
+ 81
+ ]
+ ],
+ [
+ [
+ 10,
+ 81
+ ],
+ [
+ 9,
+ 82
+ ],
+ [
+ 10,
+ 83
+ ],
+ [
+ 11,
+ 82
+ ],
+ [
+ 10,
+ 81
+ ]
+ ]
+ ]
+}
=====================================
tests/data/input/issues-174.json
=====================================
@@ -0,0 +1,27 @@
+{
+ "type": "Polygon",
+ "coordinates": [
+ [
+ [
+ -179.99883180343977,
+ 47.68693582684611
+ ],
+ [
+ 179.50805906102354,
+ 47.68334380434753
+ ],
+ [
+ 179.50699395258565,
+ 47.749968120990246
+ ],
+ [
+ -179.9988341980868,
+ 47.75356397881128
+ ],
+ [
+ -179.99883180343977,
+ 47.68693582684611
+ ]
+ ]
+ ]
+}
=====================================
tests/data/output/flat/issues-171.json
=====================================
@@ -0,0 +1,85 @@
+{
+ "type": "Polygon",
+ "coordinates": [
+ [
+ [
+ -180.0,
+ 80.0
+ ],
+ [
+ -160.0,
+ 80.0
+ ],
+ [
+ -120.0,
+ 80.0
+ ],
+ [
+ -80.0,
+ 80.0
+ ],
+ [
+ -40.0,
+ 80.0
+ ],
+ [
+ 0.0,
+ 80.0
+ ],
+ [
+ 40.0,
+ 80.0
+ ],
+ [
+ 80.0,
+ 80.0
+ ],
+ [
+ 120.0,
+ 80.0
+ ],
+ [
+ 160.0,
+ 80.0
+ ],
+ [
+ 180.0,
+ 80.0
+ ],
+ [
+ 180.0,
+ 90.0
+ ],
+ [
+ -180.0,
+ 90.0
+ ],
+ [
+ -180.0,
+ 80.0
+ ]
+ ],
+ [
+ [
+ 10.0,
+ 81.0
+ ],
+ [
+ 9.0,
+ 82.0
+ ],
+ [
+ 10.0,
+ 83.0
+ ],
+ [
+ 11.0,
+ 82.0
+ ],
+ [
+ 10.0,
+ 81.0
+ ]
+ ]
+ ]
+}
=====================================
tests/data/output/flat/issues-174.json
=====================================
@@ -0,0 +1 @@
+{"type": "MultiPolygon", "coordinates": [[[[-180.0, 47.6851386], [-179.99883180343977, 47.68693582684611], [-179.9988341980868, 47.75356397881128], [-180.0, 47.7517648], [-180.0, 47.6851386]]], [[[180.0, 47.7517648], [179.50699395258562, 47.749968120990246], [179.50805906102357, 47.68334380434753], [180.0, 47.6851386], [180.0, 47.7517648]]]]}
=====================================
tests/data/output/spherical/issues-171.json
=====================================
@@ -0,0 +1,85 @@
+{
+ "type": "Polygon",
+ "coordinates": [
+ [
+ [
+ -180.0,
+ 80.5919565
+ ],
+ [
+ -160.0,
+ 80.0
+ ],
+ [
+ -120.0,
+ 80.0
+ ],
+ [
+ -80.0,
+ 80.0
+ ],
+ [
+ -40.0,
+ 80.0
+ ],
+ [
+ 0.0,
+ 80.0
+ ],
+ [
+ 40.0,
+ 80.0
+ ],
+ [
+ 80.0,
+ 80.0
+ ],
+ [
+ 120.0,
+ 80.0
+ ],
+ [
+ 160.0,
+ 80.0
+ ],
+ [
+ 180.0,
+ 80.5919565
+ ],
+ [
+ 180.0,
+ 90.0
+ ],
+ [
+ -180.0,
+ 90.0
+ ],
+ [
+ -180.0,
+ 80.5919565
+ ]
+ ],
+ [
+ [
+ 10.0,
+ 81.0
+ ],
+ [
+ 9.0,
+ 82.0
+ ],
+ [
+ 10.0,
+ 83.0
+ ],
+ [
+ 11.0,
+ 82.0
+ ],
+ [
+ 10.0,
+ 81.0
+ ]
+ ]
+ ]
+}
=====================================
tests/data/output/spherical/issues-174.json
=====================================
@@ -0,0 +1 @@
+{"type": "MultiPolygon", "coordinates": [[[[-180.0, 47.6869298], [-179.99883180343977, 47.68693582684611], [-179.9988341980868, 47.75356397881128], [-180.0, 47.753558], [-180.0, 47.6869298]]], [[[180.0, 47.753558], [179.50699395258562, 47.749968120990246], [179.50805906102357, 47.68334380434753], [180.0, 47.6869298], [180.0, 47.753558]]]]}
=====================================
tests/test_polygon.py
=====================================
@@ -19,6 +19,7 @@ from .conftest import Reader
"crossing-latitude",
"extra-crossing",
"issues-81",
+ "issues-171",
"latitude-band",
"north-pole",
"one-hole",
@@ -112,7 +113,7 @@ def test_dont_segment_antimeridian_overlap(minx: float, maxx: float) -> None:
assert fixed.geom_type == "Polygon"
- at pytest.mark.parametrize("name", ("cw-only", "cw-split"))
+ at pytest.mark.parametrize("name", ("cw-only", "cw-split", "issues-174"))
@pytest.mark.parametrize(
"subdirectory,great_circle",
[("flat", False), ("spherical", True)],
=====================================
uv.lock
=====================================
The diff for this file was not included because it is too large.
View it on GitLab: https://salsa.debian.org/debian-gis-team/antimeridian/-/commit/f5510165f2efc035177f61b0d726eeea2c602e9b
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/antimeridian/-/commit/f5510165f2efc035177f61b0d726eeea2c602e9b
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20250810/ed75725d/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list