Compare commits

..

No commits in common. "c4812c4bd055bc52ab7aa08607552f2eac073c0c" and "6344bc13827c7036d2abb9fb788456e65f8149a3" have entirely different histories.

3 changed files with 18 additions and 15 deletions

View File

@ -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 libgdal-dev wget optipng imagemagick -y
RUN apt-get update && apt-get install libblas-dev python3-pip libgeos-dev wget optipng imagemagick -y
COPY requirements.txt ./
RUN pip install -r requirements.txt

16
main.py
View File

@ -28,23 +28,27 @@ 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.0]]).T
coordinate_transform = np.array([[1.0, 1.6]]).T
ax = plt.axes(aspect="equal")
union = data.unary_union
for bundesland in data["bundesland"].unique():
bundesland_df = data[data["bundesland"] == bundesland]
union = bundesland_df.unary_union
for geom in getattr(union, "geoms", [union]):
ax.fill(
*geom.exterior.xy,
*(geom.exterior.xy * coordinate_transform),
fc=map_background_color,
ec=image_background_color,
linewidth=0.1,
)
if any(data["highlighted"]):
union = data[data["highlighted"]].unary_union
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,
*(geom.exterior.xy * coordinate_transform),
fc=map_accent_color,
ec=None,
)

View File

@ -1,3 +1,2 @@
numpy==1.26.4
geopandas==0.11.1
matplotlib==3.6.2