[Git][debian-gis-team/python-shapely][upstream] New upstream version 2.1.0
Bas Couwenberg (@sebastic)
gitlab at salsa.debian.org
Thu Apr 3 14:09:12 BST 2025
Bas Couwenberg pushed to branch upstream at Debian GIS Project / python-shapely
Commits:
e70273be by Bas Couwenberg at 2025-04-03T14:59:11+02:00
New upstream version 2.1.0
- - - - -
8 changed files:
- .github/workflows/release.yml
- CHANGES.txt
- CITATION.cff
- + docs/code/coverage_simplify.py
- docs/coverage.rst
- docs/environment.yml
- docs/release/2.x.rst
- shapely/_version.py
Changes:
=====================================
.github/workflows/release.yml
=====================================
@@ -113,7 +113,7 @@ jobs:
shell: bash
- name: Build wheels
- uses: pypa/cibuildwheel at v2.23.0
+ uses: pypa/cibuildwheel at v2.23.2
env:
CIBW_ARCHS: ${{ matrix.arch }}
# TEMP don't use automated/isolated build environment, but manually
@@ -186,7 +186,7 @@ jobs:
if: ${{ matrix.msvc_arch }}
- name: Build wheels
- uses: pypa/cibuildwheel at v2.23.0
+ uses: pypa/cibuildwheel at v2.23.2
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_ENVIRONMENT_MACOS:
=====================================
CHANGES.txt
=====================================
@@ -1,88 +1,20 @@
Changes
=======
-2.1.0 (unreleased)
+2.1.0 (2025-04-03)
------------------
-API changes:
+Shapely 2.1.0 is a feature release with various new functions,
+improvements and bug fixes. Highlights include initial support for geometries
+with M or ZM values, functionality for coverage validation and
+simplification, and a set of new top-level functions.
-- Equality of geometries (``geom1 == geom2``) now considers NaN coordinate
- values in the same location to be equal (#1775). It is recommended however to
- ensure geometries don't have NaN values in the first place, for which you can
- now use the ``handle_nan`` parameter in construction functions.
+Shapely supports Python >= 3.10, and binary wheels on PyPI include GEOS 3.13.1
+and are now also provided for musllinux (Alpine) x86_64 platforms.
-Bug fixes:
-
-- Prevent crash when serializing a number > 1e100 to WKT with GEOS < 3.13. (#1907)
-- Ensure ``plot_polygon`` does not color the interiors of polygons (#1933).
-- Fixes GeoJSON serialization of empty points (#2118)
-- Fixes `__geo_interface__` handling of empty points (#2120)
-- Fixes ``GeometryCollection()`` constructor accepting an array of geometries (#2017).
-
-Improvements:
-
-- Add a ``handle_nan`` parameter to ``shapely.points()``,
- ``shapely.linestrings()`` and ``shapely.linearrings()`` to allow, skip, or
- error on nonfinite (NaN / Inf) coordinates. The default behaviour (allow) is
- backwards compatible (#1594, #1811).
-- Add an ``interleaved`` parameter to ``shapely.transform()`` allowing a transposed call
- signature in the ``transformation`` function.
-- The ``include_z`` in ``shapely.transform()`` now also allows ``None``, which
- lets it automatically detect the dimensionality of each input geometry.
-- Add an ``include_m`` keyword in ``to_ragged_array`` and ``get_coordinates`` (#2234, #2235)
-- Add parameters ``method`` and ``keep_collapsed`` to ``shapely.make_valid()`` (#1941)
-- The ``voronoi_polygons`` now accepts the ``ordered`` keyword, optionally forcing the
- order of polygons within the GeometryCollection to follow the order of input
- coordinates. Requires at least GEOS 3.12. (#1968)
-- Add option on ``invalid="fix"`` to ``from_wkb`` and ``from_wkt`` (#2094)
-- Add a ``normalize`` keyword to ``equals_exact`` (#1231)
-- Handle ``Feature`` type in ``shapely.geometry.shape`` (#1815)
-- Add support to split polygons by multilinestrings (#2206)
-- Add an ``m`` attribute on the Point class and an ``has_m`` attribute on the base Geometry class.
-
-New functions:
-
-- Add ``disjoint_subset_union`` and ``disjoint_subset_union_all`` as an optimized
- version of union and union_all, assuming inputs can be divided into subsets that do
- not intersect. Requires at least GEOS 3.12.
-- Add function ``minimum_clearance_line`` (#2106)
-- Add function ``maximum_inscribed_circle`` (#1307)
-- Add function ``orient_polygons`` (#2147)
-- Add function ``constrained_delaunay_triangles`` (#1685)
-- Add function ``coverage_simplify`` to allow topological simplification of polygonal
- coverages (#1969)
-- Add function ``coverage_is_valid`` and ``coverage_invalid_edges`` to validate
- an array of geometries as valid topological coverage (#2156)
-- Add function ``equals_identical`` (#1760)
-- Add function ``has_m`` (#2008)
-- Add function ``get_m`` (#2019)
-
-Breaking changes in GEOS 3.12:
-
-- ``oriented_envelope`` / ``minimum_rotated_rectangle`` changed its implementation
- in GEOS 3.12. Be aware that results will change when updating GEOS. Coincidentally
- the implementation is similar to the shapely 1.x approach. (#1885)
-- ``get_coordinate_dimension`` / ``has_z`` now considers geometries three dimensional if
- they have a NaN z coordinate. (#1885)
-- ``voronoi_polygons`` changed its output from a LINESTRING to a MULTILINESTRING in case
- ``only_edges=True``. (#1885)
-- The WKT representation of a MULTIPOINT changed from for example "MULTIPOINT (0 0, 1 1)"
- to "MULTIPOINT ((0 0), (1 1))". (#1885)
-
-Deprecations:
-
-- The ``shapely.geos`` module is deprecated. All GEOS-version related attributes are
- available directly from the top-level ``shapely`` namespace as well (already since
- shapely 2.0) (#2145).
-- The ``shapely.vectorized`` module is deprecated. The two functions (``contains and
- ``touches``) can be replaced by the top-level vectorized functions ``contains_xy``
- and ``intersects_xy`` (#1630).
-
-Packaging:
+For a full changelog, see
+https://shapely.readthedocs.io/en/latest/release/2.x.html#version-2-1-0
-- Require GEOS >= 3.9, NumPy >= 1.21, and Python >= 3.10 (#1802, #1885, #2124)
-- Binary wheels are now built for musllinux (Alpine) x86_64 platforms (#1996).
-- Upgraded the GEOS version in the binary wheel distributions to 3.13.1.
2.0.7 (2025-01-30)
------------------
=====================================
CITATION.cff
=====================================
@@ -2,8 +2,8 @@ cff-version: 1.2.0
message: "Please cite this software using these metadata."
type: software
title: Shapely
-version: "2.0.7"
-date-released: "2025-01-30"
+version: "2.1.0"
+date-released: "2025-04-03"
doi: 10.5281/zenodo.5597138
abstract: "Manipulation and analysis of geometric objects in the Cartesian plane."
repository-artifact: https://pypi.org/project/Shapely
=====================================
docs/code/coverage_simplify.py
=====================================
@@ -0,0 +1,53 @@
+import urllib.request
+
+import numpy as np
+import matplotlib.pyplot as plt
+
+import shapely
+from shapely.plotting import plot_polygon
+
+from figures import SIZE, BLUE
+
+## Downloading and preprocessing data
+
+# download countries geojson from https://datahub.io/core/geo-countries
+with urllib.request.urlopen("https://datahub.io/core/geo-countries/_r/-/data/countries.geojson") as f:
+ geojson = f.read().decode("utf-8")
+
+geoms = np.asarray(shapely.from_geojson(geojson).geoms)
+
+# select countries of Africa
+clip_polygon = shapely.from_wkt("POLYGON ((-23.714863 14.983714, 0.434636 -51.130505, 52.292267 -50.120681, 60.184885 -22.43548, 57.448957 14.358282, 44.596307 11.524365, 33.72577 34.648769, 7.226985 39.73104, -16.429284 33.649053, -23.714863 14.983714))")
+geoms_africa = geoms[shapely.within(geoms, clip_polygon)]
+
+# remove small islands for nicer illustration of coverage
+temp = geoms_africa[shapely.area(geoms_africa) > 0.1]
+parts, indices = shapely.get_parts(temp, return_index=True)
+mask = shapely.area(parts) > 0.08
+temp = shapely.multipolygons(parts[mask], indices=indices[mask])
+
+# set precision to improve coverage validity
+geoms_africa2 = shapely.set_precision(temp, 0.001)
+
+## Coverage simplify
+
+geoms_africa_simplified = shapely.coverage_simplify(geoms_africa2, tolerance=5.0)
+
+# plot
+fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=SIZE, dpi=90)
+
+for geom in geoms_africa2:
+ plot_polygon(geom, ax=ax1, add_points=False, color=BLUE)
+
+ax1.set_title('a) original data')
+ax1.axis("off")
+ax1.set_aspect("equal")
+
+for geom in geoms_africa_simplified:
+ plot_polygon(geom, ax=ax2, add_points=False, color=BLUE)
+
+ax2.set_title('b) coverage simplified')
+ax2.axis("off")
+ax2.set_aspect("equal")
+
+plt.show()
=====================================
docs/coverage.rst
=====================================
@@ -9,3 +9,5 @@ Coverage operations
{% for function in get_module_functions("_coverage") %}
{{ function }}
{% endfor %}
+ coverage_union
+ coverage_union_all
=====================================
docs/environment.yml
=====================================
@@ -2,8 +2,8 @@ name: shapely_docs
channels:
- conda-forge
dependencies:
- - python=3.10
- - geos=3.11
+ - python=3.12
+ - geos=3.13
- numpy
- cython
- sphinx-book-theme
=====================================
docs/release/2.x.rst
=====================================
@@ -3,7 +3,7 @@ Version 2.x
.. _version-2-1-0:
-Version 2.1.0 (unreleased)
+Version 2.1.0 (2025-04-03)
--------------------------
New features
@@ -14,6 +14,18 @@ Initial support for geometries with M or ZM values
Shapely geometries can now represent coordinates with M values (measure) in
addition to X, Y, and Z (requires GEOS >= 3.12).
+
+.. code:: python
+
+ >>> import shapely
+ >>> point_m = shapely.from_wkt("POINT M (5.2 52.1 15.3)")
+ >>> point_m
+ <POINT M (5.2 52.1 15.3)>
+ >>> point_m.has_m
+ True
+ >>> point_m.m
+ 15.3
+
The initial support includes:
- Creating geometries from WKT or WKB with M values will now preserve the M
@@ -27,6 +39,22 @@ The initial support includes:
- Add an ``include_m`` keyword in ``to_ragged_array`` and ``get_coordinates``
(#2234, #2235).
+Coverage validation and simplification
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Several functions have been added to work with coverages (requires GEOS >=
+3.12), where a coverage is made up of a collection of valid (multi)polygons that
+do not overlap and are edge-matched (vertices along shared edges are identical).
+
+The :func:`.coverage_is_valid` and :func:`.coverage_invalid_edges` functions
+help to validate an array of geometries as a topological coverage and
+inspect invalid edges. The :func:`.coverage_simplify` function then allows
+topological simplification of the coverage (in contrast to the existing
+:func:`.simplify` function, which simplifies an array of geometries one by one,
+independently).
+
+.. plot:: code/coverage_simplify.py
+
New functions
~~~~~~~~~~~~~
=====================================
shapely/_version.py
=====================================
@@ -25,9 +25,9 @@ def get_keywords():
# setup.py/versioneer.py will grep for the variable names, so they must
# each be defined on a line of their own. _version.py will just call
# get_keywords().
- git_refnames = " (HEAD -> main, tag: 2.1.0rc1)"
- git_full = "7cd599893ea3b478b662189449514a239da5751d"
- git_date = "2025-03-15 15:43:48 +0100"
+ git_refnames = " (HEAD -> main, tag: 2.1.0)"
+ git_full = "4940c6405ac9ef2d77c9e9990954b68294c3c399"
+ git_date = "2025-04-03 10:55:05 +0200"
keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
return keywords
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-shapely/-/commit/e70273be73138ed876e3e7f7f3f9e8ccccac2b0c
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-shapely/-/commit/e70273be73138ed876e3e7f7f3f9e8ccccac2b0c
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/20250403/aa08bebe/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list