From 187faf6cd5d15e820f4d283b530d8adc6c9bd260 Mon Sep 17 00:00:00 2001 From: Lukas Grossberger Date: Thu, 27 Jun 2024 21:34:25 +0200 Subject: [PATCH 1/3] add system dependency libgal-dev explicitly --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e43df03..7b836fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ ARG PLZ_DATA=Postleitzahlengebiete_-_OSM.geojson ARG PLZ_HIGHLIGHT=wtf_member_plz_prefixes.json # Set up environment with dependencies -RUN apt-get update && apt-get install libblas-dev python3-pip libgeos-dev wget optipng imagemagick -y +RUN apt-get update && apt-get install libblas-dev python3-pip libgeos-dev libgdal-dev wget optipng imagemagick -y COPY requirements.txt ./ RUN pip install -r requirements.txt From f6560772cb92b5c5b11bb82035a59b90d0a1902e Mon Sep 17 00:00:00 2001 From: Lukas Grossberger Date: Thu, 27 Jun 2024 21:34:52 +0200 Subject: [PATCH 2/3] pin numpy to most recent 1.* release --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index e290df5..84a54ac 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ +numpy==1.26.4 geopandas==0.11.1 matplotlib==3.6.2 \ No newline at end of file From 85d932e23e53e013da5d593a6a3561c0ee1f3fe7 Mon Sep 17 00:00:00 2001 From: Lukas Grossberger Date: Thu, 27 Jun 2024 21:35:28 +0200 Subject: [PATCH 3/3] disable state border plotting due to missing data --- main.py | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/main.py b/main.py index ab32437..227ebe4 100644 --- a/main.py +++ b/main.py @@ -28,27 +28,23 @@ def main( data.loc[data["plz"].str.startswith(plz_prefix), "highlighted"] = True # TODO: This should instead be a proper geo spatial projection - coordinate_transform = np.array([[1.0, 1.6]]).T + coordinate_transform = np.array([[1.0, 1.0]]).T ax = plt.axes(aspect="equal") - for bundesland in data["bundesland"].unique(): - bundesland_df = data[data["bundesland"] == bundesland] - union = bundesland_df.unary_union + union = data.unary_union + for geom in getattr(union, "geoms", [union]): + ax.fill( + *geom.exterior.xy, + fc=map_background_color, + ec=image_background_color, + linewidth=0.1, + ) + + if any(data["highlighted"]): + union = data[data["highlighted"]].unary_union for geom in getattr(union, "geoms", [union]): ax.fill( - *(geom.exterior.xy * coordinate_transform), - fc=map_background_color, - ec=image_background_color, - linewidth=0.1, - ) - - if not any(bundesland_df["highlighted"]): - continue - - union = bundesland_df[bundesland_df["highlighted"]].unary_union - for geom in getattr(union, "geoms", [union]): - ax.fill( - *(geom.exterior.xy * coordinate_transform), + *geom.exterior.xy, fc=map_accent_color, ec=None, )