BUG: assign Crimea to Ukraine in naturalearth_lowres (#2670)

This commit is contained in:
Martin Fleischmann
2022-12-10 15:33:58 +01:00
committed by GitHub
parent 4b72fb417a
commit 361cd183da
6 changed files with 29 additions and 6 deletions
+4 -5
View File
@@ -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
<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)
----------------------------
@@ -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
+1 -1
View File
@@ -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)),