Updated data source, reordered

This commit is contained in:
2022-08-29 02:22:05 +02:00
parent ad245ee780
commit 9d72386fc6
4 changed files with 8 additions and 15 deletions

View File

@@ -1,5 +1,6 @@
# PLZ Karte Deutschland # PLZ Karte Deutschland
_tbd_ Stellt mittels [Folium](http://python-visualization.github.io/folium/) die Regionen Deutschlands nach den ersten zwei Ziffern der Postleitzahl dar. Die Regionen sind nach der ersten Ziffer eingefärbt.
[Link](https://checksch.de/pa-pyscript/map/map.html) - [Aufrufbare Instanz](https://checksch.de/pa-pyscript/map/map.html)
- [Datenquelle](https://www.suche-postleitzahl.org/downloads)

File diff suppressed because one or more lines are too long

1
map/plz-2stellig.geojson Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,17 +1,8 @@
import pandas as pd
import folium
import json
import random
from pyodide.http import open_url from pyodide.http import open_url
import folium, json
data = "./data.json"
geo_json = json.loads(open_url(data).read())
m = folium.Map(location=[50.4, 9.6], zoom_start=6)
def style(x): def style(x):
match (x["properties"]["plz"]): match (x["properties"]["plz"][0]):
case "0": return {"color": "yellow"} case "0": return {"color": "yellow"}
case "1": return {"color": "orange"} case "1": return {"color": "orange"}
case "2": return {"color": "tomato"} case "2": return {"color": "tomato"}
@@ -24,7 +15,8 @@ def style(x):
case "9": return {"color": "slateblue"} case "9": return {"color": "slateblue"}
return {"color": "black"} return {"color": "black"}
geo_json = json.loads(open_url("./plz-2stellig.geojson").read())
m = folium.Map(location=[50.4, 9.6], zoom_start=6)
folium.GeoJson(geo_json, name="Postleitzahl", style_function=lambda x: style(x)).add_to( folium.GeoJson(geo_json, name="Postleitzahl", style_function=lambda x: style(x)).add_to(
m m
) )