From 361cd183da17c7110e8a8cf474c50a87d21cf69c Mon Sep 17 00:00:00 2001 From: Martin Fleischmann Date: Sat, 10 Dec 2022 15:33:58 +0100 Subject: [PATCH] BUG: assign Crimea to Ukraine in naturalearth_lowres (#2670) --- CHANGELOG.md | 9 +++---- geopandas/datasets/naturalearth_creation.py | 24 ++++++++++++++++++ .../naturalearth_lowres.dbf | Bin 50285 -> 50285 bytes .../naturalearth_lowres.shp | Bin 180924 -> 180744 bytes .../naturalearth_lowres.shx | Bin 1516 -> 1516 bytes geopandas/tests/test_sindex.py | 2 +- 6 files changed, 29 insertions(+), 6 deletions(-) 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 3f801ec9ecdf5a0b390769a19304d30ded460d39..25e21faf0cc99fcd739edeb3e164d4c98e46e90f 100644 GIT binary patch delta 15 WcmaFc!Th#^nT5HEhifBC<`Dod4Fzfd delta 15 WcmaFc!Th#^nT5HEQ)nYg<`DodBL!~& diff --git a/geopandas/datasets/naturalearth_lowres/naturalearth_lowres.shp b/geopandas/datasets/naturalearth_lowres/naturalearth_lowres.shp index 9318e45c7015568100ad4d7a271790fbec966876..5a3440b253e0c28764a3466fa970daeeadfbc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