diff --git a/.github/workflows/map_workflow.yml b/.github/workflows/map_workflow.yml index ddf2c48..1719856 100644 --- a/.github/workflows/map_workflow.yml +++ b/.github/workflows/map_workflow.yml @@ -22,6 +22,7 @@ jobs: bash download_prerequistes.sh python generate_map.py python generate_map.py germany + python generate_map.py nogermany - name: Release Map uses: "softprops/action-gh-release@v1" if: startsWith(github.ref, 'refs/tags/') @@ -29,5 +30,6 @@ jobs: token: "${{ secrets.GITHUB_TOKEN }}" files: | germany.svg + restofeur.svg europe.svg map.html diff --git a/.gitignore b/.gitignore index cdd9c8d..7ae2e29 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,8 @@ data/*.geojson .mapenv # output files map.html -europe.* -germany.* +*.svg +*.png +*.jpg # .vscode folder .vscode \ No newline at end of file diff --git a/data/plotted_locations.json b/data/plotted_locations.json index bef5f91..b731f08 100644 --- a/data/plotted_locations.json +++ b/data/plotted_locations.json @@ -9,8 +9,8 @@ { "common_name": "Zürich", "id_name": "Zürich", - "stage": "Mixed", - "num_users": 4, + "stage": "Production", + "num_users": 1, "country_code": "CH" }, { @@ -20,30 +20,72 @@ "num_users": 4, "country_code": "DE" }, + { + "common_name": "Berlin", + "id_name": "Berlin", + "stage": "Planned", + "num_users": 4, + "country_code": "DE" + }, + { + "common_name": "Bielefeld", + "id_name": "Bielefeld, Kreisfreie Stadt", + "stage": "Test", + "num_users": 1, + "country_code": "DE" + }, + { + "common_name": "Bonn", + "id_name": "Bonn, Kreisfreie Stadt", + "stage": "Mixed", + "num_users": 2, + "country_code": "DE" + }, { "common_name": "Braunschweig", "id_name": "Braunschweig, Kreisfreie Stadt", - "stage": "Test", + "stage": "Production", "num_users": 2, "country_code": "DE" }, + { + "common_name": "Colonge", + "id_name": "Köln, Kreisfreie Stadt", + "stage": "Production", + "num_users": 1, + "country_code": "DE" + }, { "common_name": "Chemnitz", "id_name": "Chemnitz, Kreisfreie Stadt", "stage": "Production", - "num_users": 1, + "num_users": 2, "country_code": "DE" }, { "common_name": "Dresden", "id_name": "Dresden, Kreisfreie Stadt", - "stage": "Test", + "stage": "Production", "num_users": 1, "country_code": "DE" }, { "common_name": "Duisburg-Essen", "id_name": "Duisburg, Kreisfreie Stadt", + "stage": "Test", + "num_users": 1, + "country_code": "DE" + }, + { + "common_name": "Düsseldorf", + "id_name": "Düsseldorf, Kreisfreie Stadt", + "stage": "Production", + "num_users": 1, + "country_code": "DE" + }, + { + "common_name": "Frankfurt", + "id_name": "Frankfurt am Main, Kreisfreie Stadt", "stage": "Production", "num_users": 1, "country_code": "DE" @@ -51,7 +93,14 @@ { "common_name": "Freiburg", "id_name": "Freiburg im Breisgau, Stadtkreis", - "stage": "Test", + "stage": "Production", + "num_users": 1, + "country_code": "DE" + }, + { + "common_name": "Geesthacht", + "id_name": "Herzogtum Lauenburg", + "stage": "Planned", "num_users": 1, "country_code": "DE" }, @@ -62,6 +111,20 @@ "num_users": 1, "country_code": "DE" }, + { + "common_name": "Halle", + "id_name": "Halle (Saale), Kreisfreie Stadt", + "stage": "Production", + "num_users": 1, + "country_code": "DE" + }, + { + "common_name": "Hannover", + "id_name": "Region Hannover", + "stage": "Planned", + "num_users": 1, + "country_code": "DE" + }, { "common_name": "Heidelberg", "id_name": "Heidelberg, Stadtkreis", @@ -87,27 +150,34 @@ "common_name": "Karlsruhe", "id_name": "Karlsruhe, Stadtkreis", "stage": "Mixed", - "num_users": 5, + "num_users": 6, "country_code": "DE" }, { "common_name": "Kiel", "id_name": "Kiel, Kreisfreie Stadt", - "stage": "Test", + "stage": "Production", "num_users": 1, "country_code": "DE" }, { - "common_name": "Colonge", - "id_name": "Köln, Kreisfreie Stadt", - "stage": "Test", + "common_name": "Konstanz", + "id_name": "Konstanz", + "stage": "Production", + "num_users": 1, + "country_code": "DE" + }, + { + "common_name": "Leipzig", + "id_name": "Leipzig", + "stage": "Production", "num_users": 1, "country_code": "DE" }, { "common_name": "Mainz", "id_name": "Mainz, Kreisfreie Stadt", - "stage": "Test", + "stage": "Production", "num_users": 1, "country_code": "DE" }, @@ -115,7 +185,14 @@ "common_name": "Munich", "id_name": "München, Kreisfreie Stadt", "stage": "Mixed", - "num_users": 1, + "num_users": 3, + "country_code": "DE" + }, + { + "common_name": "Münster", + "id_name": "Münster, Kreisfreie Stadt", + "stage": "Production", + "num_users": 2, "country_code": "DE" }, { @@ -126,16 +203,23 @@ "country_code": "DE" }, { - "common_name": "Stuttgart", - "id_name": "Stuttgart, Stadtkreis", + "common_name": "Regensburg", + "id_name": "Regensburg, Kreisfreie Stadt", "stage": "Production", "num_users": 2, "country_code": "DE" }, { - "common_name": "Ulm", - "id_name": "Ulm, Stadtkreis", - "stage": "Planned", + "common_name": "Rostock", + "id_name": "Landkreis Rostock", + "stage": "Production", + "num_users": 1, + "country_code": "DE" + }, + { + "common_name": "Stuttgart", + "id_name": "Stuttgart, Stadtkreis", + "stage": "Production", "num_users": 1, "country_code": "DE" }, @@ -180,5 +264,26 @@ "stage": "Planned", "num_users": 1, "country_code": "IN" + }, + { + "common_name": "London", + "id_name": "Camden and City of London", + "stage": "Planned", + "num_users": 1, + "country_code": "UK" + }, + { + "common_name": "Lexington", + "id_name": "Lexington", + "stage": "Planned", + "num_users": 1, + "country_code": "US" + }, + { + "common_name": "Oakland", + "id_name": "Oakland", + "stage": "Planned", + "num_users": 1, + "country_code": "US" } ] \ No newline at end of file diff --git a/generate_map.py b/generate_map.py index 4405657..682552f 100644 --- a/generate_map.py +++ b/generate_map.py @@ -9,6 +9,7 @@ # no need to change unless changes in apprearance are required. Please know what you are doing. # static map only for Germany, not other european countries only_germany = len(sys.argv) > 1 and sys.argv[1] == "germany" +no_germany = len(sys.argv) > 1 and sys.argv[1] == "nogermany" color = {"Production": "green", # color codes for different types of instances "Mixed": "blue", # color supported in dynamic map are listed here https://github.com/pointhi/leaflet-color-markers "Test": "orange", @@ -25,8 +26,12 @@ legend_location = (0.2, 0.7) color_based_on = "NUTS_NAME" map_filename = "germany.svg" +elif no_germany: + legend_location = (0.7, 0.3) + color_based_on = "CNTR_CODE" + map_filename = "restofeur.svg" else: - legend_location = (1.0, 0.4) + legend_location = (0.7, 0.3) color_based_on = "CNTR_CODE" map_filename = "europe.svg" @@ -54,6 +59,15 @@ eur_country = eur_country[eur_country.CNTR_CODE.isin( locations["country_code"].unique().tolist())] eur_country_list = eur_country.CNTR_CODE.unique().tolist() +if no_germany: + eur_country.drop( + eur_country[eur_country.CNTR_CODE.isin(["DE"])].index, inplace=True) + try: + eur_country_list.remove("DE") + except ValueError: + pass +if not len(eur_country_list): + print("WARNING: No European to be plotted.") # modifications to eur map, if any # keep only mainland parts for conciseness @@ -117,20 +131,18 @@ plt.axis('off') plt.savefig(map_filename) -if only_germany: +if only_germany or no_germany: exit() # exit after producing the static map ######################## # Plot the dynamic map # ######################## -# opposite of what can happen so that the values are always overwritten -map_limits = {"lon": {}, "lat": {}} - -map_limits["lat"]["max"] = locations.latitude.max() + dynamic_map_padding -map_limits["lat"]["min"] = locations.latitude.min() - dynamic_map_padding -map_limits["lon"]["max"] = locations.longitude.max() + dynamic_map_padding -map_limits["lon"]["min"] = locations.longitude.min() - dynamic_map_padding +# limits of the dynamic +map_limits = {"lon": {"max": locations.longitude.max() + dynamic_map_padding, + "min": locations.longitude.min() - dynamic_map_padding}, + "lat": {"max": locations.latitude.max() + dynamic_map_padding, + "min": locations.latitude.min() - dynamic_map_padding}} # load templated text for the dynamic map html_text = (data_dir / "template.html").read_text()