Compare commits

...

4 Commits
main ... hs2

Author SHA1 Message Date
67539333bf test: HS adjustment 2024-06-28 16:37:50 +02:00
Lukas Grossberger
85d932e23e disable state border plotting due to missing data 2024-06-27 21:35:28 +02:00
Lukas Grossberger
f6560772cb pin numpy to most recent 1.* release 2024-06-27 21:34:52 +02:00
Lukas Grossberger
187faf6cd5 add system dependency libgal-dev explicitly 2024-06-27 21:34:25 +02:00
3 changed files with 18 additions and 21 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 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

22
main.py
View File

@ -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 * coordinate_transform),
*geom.exterior.xy,
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
if any(data["highlighted"]):
union = data[data["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,
)
@ -87,19 +83,19 @@ if __name__ == "__main__":
parser.add_argument(
"--img-bg-color",
type=str,
default="#EDEFEB",
default="#FFFFFF",
help="Color outside of the map, the image file background.",
)
parser.add_argument(
"--map-bg-color",
type=str,
default="#202020",
default="#4279BC",
help="Color code for the background map, non highlighted areas.",
)
parser.add_argument(
"--map-accent-color",
type=str,
default="#EF7C21",
default="#DA532C",
help="Color code for the highlighted areas on the map.",
)
args = parser.parse_args()

View File

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