Skip to content

Commit

Permalink
udpdate codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
harivyasi committed Aug 30, 2024
1 parent 7d0fbee commit 70a1325
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions developer_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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

Expand Down
9 changes: 5 additions & 4 deletions generate_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 70a1325

Please sign in to comment.