[Git][debian-gis-team/python-geopandas][upstream] New upstream version 0.14.2

Bas Couwenberg (@sebastic) gitlab at salsa.debian.org
Fri Jan 5 05:45:13 GMT 2024



Bas Couwenberg pushed to branch upstream at Debian GIS Project / python-geopandas


Commits:
fa536cfb by Bas Couwenberg at 2024-01-05T06:30:08+01:00
New upstream version 0.14.2
- - - - -


5 changed files:

- CHANGELOG.md
- geopandas/_version.py
- geopandas/explore.py
- geopandas/tests/test_explore.py
- geopandas/tools/overlay.py


Changes:

=====================================
CHANGELOG.md
=====================================
@@ -1,5 +1,11 @@
 # Changelog
 
+## Version 0.14.2 (Jan 4, 2024)
+
+- Fix regression in `overlay` where using `buffer(0)` instead of `make_valid` internally
+  produced invalid results (#3074).
+- Fix `explore()` method when the active geometry contains missing and empty geometries (#3094).
+
 ## Version 0.14.1 (Nov 11, 2023)
 
 - The Parquet and Feather IO functions now support the latest 1.0.0 version


=====================================
geopandas/_version.py
=====================================
@@ -25,9 +25,9 @@ def get_keywords() -> Dict[str, str]:
     # 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 = " (tag: v0.14.1, 0.14.x)"
-    git_full = "9a9f0974db087ce303b94bfbeabc8ea136be0914"
-    git_date = "2023-11-11 10:29:16 +0100"
+    git_refnames = " (tag: v0.14.2, 0.14.x)"
+    git_full = "fb079bf07adb889a720532d871798d75c90f50b5"
+    git_date = "2024-01-04 22:30:04 +0100"
     keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
     return keywords
 


=====================================
geopandas/explore.py
=====================================
@@ -618,7 +618,9 @@ def _explore(
         tooltip = None
         popup = None
     # escape the curly braces {{}} for jinja2 templates
-    feature_collection = gdf.__geo_interface__
+    feature_collection = gdf[
+        ~(gdf.geometry.isna() | gdf.geometry.is_empty)  # drop missing or empty geoms
+    ].__geo_interface__
     for feature in feature_collection["features"]:
         for k in feature["properties"]:
             # escape the curly braces in values


=====================================
geopandas/tests/test_explore.py
=====================================
@@ -2,6 +2,7 @@ import geopandas as gpd
 import numpy as np
 import pandas as pd
 import pytest
+import shapely
 from packaging.version import Version
 
 folium = pytest.importorskip("folium")
@@ -940,3 +941,17 @@ class TestExplore:
                     "zoom_control": False,
                 }
             )
+
+    def test_none_geometry(self):
+        # None and empty geoms are dropped prior plotting
+        df = self.nybb.copy()
+        df.loc[0, df.geometry.name] = None
+        m = df.explore()
+        self._fetch_map_string(m)
+
+    def test_empty_geometry(self):
+        # None and empty geoms are dropped prior plotting
+        df = self.nybb.copy()
+        df.loc[0, df.geometry.name] = shapely.Point()
+        m = df.explore()
+        self._fetch_map_string(m)


=====================================
geopandas/tools/overlay.py
=====================================
@@ -4,7 +4,6 @@ from functools import reduce
 import numpy as np
 import pandas as pd
 
-from geopandas import _compat as compat
 from geopandas import GeoDataFrame, GeoSeries
 from geopandas.array import _check_crs, _crs_mismatch_warn
 
@@ -94,10 +93,8 @@ def _overlay_difference(df1, df2):
         new_g.append(new)
     differences = GeoSeries(new_g, index=df1.index, crs=df1.crs)
     poly_ix = differences.geom_type.isin(["Polygon", "MultiPolygon"])
-    if compat.USE_PYGEOS:
-        differences.loc[poly_ix] = differences[poly_ix].make_valid()
-    else:
-        differences.loc[poly_ix] = differences[poly_ix].buffer(0)
+    differences.loc[poly_ix] = differences[poly_ix].make_valid()
+
     geom_diff = differences[~differences.is_empty].copy()
     dfdiff = df1[~differences.is_empty].copy()
     dfdiff[dfdiff._geometry_column_name] = geom_diff



View it on GitLab: https://salsa.debian.org/debian-gis-team/python-geopandas/-/commit/fa536cfbca955fdfa614b0cdf277e0df8f778da4

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-geopandas/-/commit/fa536cfbca955fdfa614b0cdf277e0df8f778da4
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/20240105/24cb6deb/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list