diff --git a/developer_notes.md b/developer_notes.md index 1bcb1e5..ad012d2 100644 --- a/developer_notes.md +++ b/developer_notes.md @@ -3,7 +3,7 @@ ## What is it? - The repository is useful for creating _static_ and _dynamic_ maps with pins. Each pin has a quanitity and tag associated with it. The tag also determines the color of the pin e.g. [here](https://map.chemotion.scc.kit.edu/) the tags are 'Planned usage', 'Test usage' etc and the quantity is visible by hovering over the pins. -- The repository consists primarly of a single python script called [`generate_map.py`](generate_map.py). When given a single argument `germany`, it produces a static map of Germany with instances marked on it. Otherwise it produces a static map of European countries as well as a dynamic map of the world with instances marked on it. +- The repository consists primarily of a single python script called [`generate_map.py`](generate_map.py). When given a single argument `germany`, it produces a static map of Germany with instances marked on it. Otherwise it produces a static map of European countries as well as a dynamic map of the world with instances marked on it. - The workflow is supported by data in the [`data`](data) folder. - The workflow is automated for GitHub actions using [`map_workflow`](.github/workflows/map_workflow.yml) file. @@ -56,7 +56,7 @@ This can be done by adding JSON entries to the [data/plotted_locations.json](dat }, ``` -where `common_name` is the name of the city/region (in language of your choice), `id_name` is the standard name of the city/region (in Europe) according to the NUTS standard or, for places outside Europe, the `name` as used by Natural Earth geojson (most likely the common English name), `stage` is the key that corresponds to `stage` variable in the script, `num_users` is the number of users in that location -- which then appears on the map -- and `country_code` is the [two letter country code as defined by ISO](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). +where `common_name` is the name of the city/region (in language of your choice), `id_name` is the standard name of the city/region (in Europe) according to the NUTS standard or, for places outside Europe, the `ls_name` as used by Natural Earth geojson (most likely the common English name), `stage` is the key that corresponds to `stage` variable in the script, `num_users` is the number of users in that location -- which then appears on the map -- and `country_code` is the [two letter country code as defined by ISO](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). ### Changing appearence diff --git a/generate_map.py b/generate_map.py index 612c4af..8d40f0d 100644 --- a/generate_map.py +++ b/generate_map.py @@ -27,11 +27,11 @@ color_based_on = "NUTS_NAME" map_filename = "germany.svg" elif no_germany: - legend_location = (0.8, 0.25) + legend_location = (0.8, 0.4) color_based_on = "CNTR_CODE" map_filename = "restofeur.svg" else: - legend_location = (0.5, 0.7) + legend_location = (0.8, 0.4) color_based_on = "CNTR_CODE" map_filename = "europe.svg" @@ -98,7 +98,7 @@ # try and get location from the european city list geometry = eur_location[eur_location.NUTS_NAME == row.id_name].geometry if geometry.empty: # if not then check international cities list - geometry = int_location[int_location.name == row.id_name].geometry + geometry = int_location[int_location.ls_name == row.id_name].geometry if geometry.empty: # if still not found then raise error raise IndexError( "Could not place the following location on map: "+row.common_name) @@ -125,7 +125,8 @@ eur_country.CNTR_CODE)].to_crs("EPSG:3857") # plot countries map -fig, ax = plt.subplots(1, figsize=(10, 10), tight_layout=True) +fig, ax = plt.subplots(1, tight_layout=True, + figsize=((12, 12) if only_germany else (20, 20))) ax = eur_country.plot(ax=ax, column=color_based_on, cmap='tab20', edgecolor='w') # plot the patches