hotfix/dependencies-and-plz-data-schema-change (closes #2) #3

Merged
Gro merged 3 commits from hotfix/dependencies-and-plz-data-schema-change into main 2024-06-28 16:00:02 +02:00
Showing only changes of commit 85d932e23e - Show all commits

16
main.py
View File

@ -28,27 +28,23 @@ def main(
data.loc[data["plz"].str.startswith(plz_prefix), "highlighted"] = True data.loc[data["plz"].str.startswith(plz_prefix), "highlighted"] = True
# TODO: This should instead be a proper geo spatial projection # 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") ax = plt.axes(aspect="equal")
for bundesland in data["bundesland"].unique(): union = data.unary_union
bundesland_df = data[data["bundesland"] == bundesland]
union = bundesland_df.unary_union
for geom in getattr(union, "geoms", [union]): for geom in getattr(union, "geoms", [union]):
ax.fill( ax.fill(
*(geom.exterior.xy * coordinate_transform), *geom.exterior.xy,
fc=map_background_color, fc=map_background_color,
ec=image_background_color, ec=image_background_color,
linewidth=0.1, linewidth=0.1,
) )
if not any(bundesland_df["highlighted"]): if any(data["highlighted"]):
continue union = data[data["highlighted"]].unary_union
union = bundesland_df[bundesland_df["highlighted"]].unary_union
for geom in getattr(union, "geoms", [union]): for geom in getattr(union, "geoms", [union]):
ax.fill( ax.fill(
*(geom.exterior.xy * coordinate_transform), *geom.exterior.xy,
fc=map_accent_color, fc=map_accent_color,
ec=None, ec=None,
) )