diff --git a/CHANGELOG.md b/CHANGELOG.md index f56072d..d8e384d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,11 @@ ## Development version - Bug fixes: - Correctly handle geometries with Z dimension in ``to_crs()`` when using PyGEOS or Shapely >= 2.0 (previously the z coordinates were lost) (#1345). +- Assign Crimea to Ukraine in naturalearth_lowres (#2670) ## Version 0.12.1 (October 29, 2022) @@ -19,7 +19,7 @@ test Shapely 2.0 (currently 2.0b1) alongside GeoPandas. Note that if you also have PyGEOS installed, you need to set an environment variable (`USE_PYGEOS=0`) before importing geopandas to actually test Shapely 2.0 features instead of PyGEOS. See -https://geopandas.org/en/latest/getting_started/install.html#using-the-optional-pygeos-dependency + for more details. New features and improvements: @@ -55,8 +55,8 @@ Small bug-fix release: MultiIndex (#2486). - Fix regression in ``GeoDataFrame.explode()`` with non-default geometry column name. -- Fix regression in ``apply()`` causing row-wise all nan float columns to be - casted to GeometryDtype (#2482). +- Fix regression in ``apply()`` causing row-wise all nan float columns to be + casted to GeometryDtype (#2482). - Fix a crash in datetime column reading where the file contains mixed timezone offsets (#2479). These will be read as UTC localized values. - Fix a crash in datetime column reading where the file contains datetimes @@ -68,7 +68,6 @@ Small bug-fix release: feather or parquet writer. ``version`` will only be used to set ``schema_version`` if ``version`` is one of 0.1.0 or 0.4.0 (#2496). - Version 0.11 (June 20, 2022) ---------------------------- diff --git a/geopandas/datasets/naturalearth_creation.py b/geopandas/datasets/naturalearth_creation.py index d614734..c876329 100644 --- a/geopandas/datasets/naturalearth_creation.py +++ b/geopandas/datasets/naturalearth_creation.py @@ -11,6 +11,7 @@ import requests from pathlib import Path from zipfile import ZipFile import tempfile +from shapely.geometry import box version = "latest" urlbase = "https://www.naturalearthdata.com/" @@ -89,6 +90,29 @@ for dl in config: gdf = dl["override"](gdf) gdf = gdf.loc[:, dl["cols"]] gdf = gdf.rename(columns={c: c.lower() for c in gdf.columns}) + + # override Crimea #2382 + if dl["file"] == "ne_110m_admin_0_countries.zip": + crimean_bbox = box(32.274, 44.139, 36.65, 46.704) + crimea_only = ( + gdf.loc[gdf.name == "Russia", "geometry"] + .iloc[0] + .intersection(crimean_bbox) + ) + complete_ukraine = ( + gdf.loc[gdf.name == "Ukraine", "geometry"].iloc[0].union(crimea_only) + ) + correct_russia = ( + gdf.loc[gdf.name == "Russia", "geometry"] + .iloc[0] + .difference(crimean_bbox) + ) + r_ix = gdf.loc[gdf.name == "Russia"].index[0] + gdf.at[r_ix, "geometry"] = correct_russia + + u_ix = gdf.loc[gdf.name == "Ukraine"].index[0] + gdf.at[u_ix, "geometry"] = complete_ukraine + # get changes between current version and new version if not df_same(gdf, gpd.read_file(dl["current"]), dl["file"], log): downloads[dl["file"]] = gdf diff --git a/geopandas/datasets/naturalearth_lowres/naturalearth_lowres.dbf b/geopandas/datasets/naturalearth_lowres/naturalearth_lowres.dbf index 3f801ec..25e21fa 100644 Binary files a/geopandas/datasets/naturalearth_lowres/naturalearth_lowres.dbf and b/geopandas/datasets/naturalearth_lowres/naturalearth_lowres.dbf differ diff --git a/geopandas/datasets/naturalearth_lowres/naturalearth_lowres.shp b/geopandas/datasets/naturalearth_lowres/naturalearth_lowres.shp index 9318e45..5a3440b 100644 Binary files a/geopandas/datasets/naturalearth_lowres/naturalearth_lowres.shp and b/geopandas/datasets/naturalearth_lowres/naturalearth_lowres.shp differ diff --git a/geopandas/datasets/naturalearth_lowres/naturalearth_lowres.shx b/geopandas/datasets/naturalearth_lowres/naturalearth_lowres.shx index c3728e0..275512f 100644 Binary files a/geopandas/datasets/naturalearth_lowres/naturalearth_lowres.shx and b/geopandas/datasets/naturalearth_lowres/naturalearth_lowres.shx differ diff --git a/geopandas/tests/test_sindex.py b/geopandas/tests/test_sindex.py index dbf586a..c3406dc 100644 --- a/geopandas/tests/test_sindex.py +++ b/geopandas/tests/test_sindex.py @@ -861,7 +861,7 @@ class TestPygeosInterface: @pytest.mark.parametrize( "predicate, expected_shape", [ - (None, (2, 470)), + (None, (2, 471)), ("intersects", (2, 213)), ("within", (2, 213)), ("contains", (2, 0)),