Skip to content

Commit

Permalink
rewrite
Browse files Browse the repository at this point in the history
- support for international locations
- removed all references to connections
- cleaner code for static plotting
- uses panda df to full extent
- produces two static maps - DE and EUR
  • Loading branch information
harivyasi committed Aug 15, 2023
1 parent 5b132f9 commit 3317e97
Show file tree
Hide file tree
Showing 6 changed files with 190 additions and 236 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/map_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ jobs:
pip install -r requirements.txt
bash download_prerequistes.sh
python generate_map.py
python generate_map.py germany
- name: Release Map
uses: "softprops/action-gh-release@v1"
if: startsWith(github.ref, 'refs/tags/')
with:
token: "${{ secrets.GITHUB_TOKEN }}"
files: |
map.svg
germany.svg
europe.svg
map.html
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# font files
data/*.ttf
# NUTS files
# NUTS/geojson files
data/NUTS*.json
data/*.geojson
# python env files
.mapenv
# output files
map.*
map.html
europe.*
germany.*
# .vscode folder
.vscode
123 changes: 79 additions & 44 deletions data/plotted_locations.json
Original file line number Diff line number Diff line change
@@ -1,149 +1,184 @@
[
{
"common_name": "Lausanne",
"nuts_lvl3": "Genève",
"stage": "production",
"id_name": "Genève",
"stage": "Production",
"num_users": 1,
"country_code": "CH"
},
{
"common_name": "Zürich",
"nuts_lvl3": "Zürich",
"stage": "mixed",
"id_name": "Zürich",
"stage": "Mixed",
"num_users": 4,
"country_code": "CH"
},
{
"common_name": "Aachen",
"nuts_lvl3": "Städteregion Aachen",
"stage": "production",
"id_name": "Städteregion Aachen",
"stage": "Production",
"num_users": 4,
"country_code": "DE"
},
{
"common_name": "Braunschweig",
"nuts_lvl3": "Braunschweig, Kreisfreie Stadt",
"stage": "test",
"id_name": "Braunschweig, Kreisfreie Stadt",
"stage": "Test",
"num_users": 2,
"country_code": "DE"
},
{
"common_name": "Chemnitz",
"nuts_lvl3": "Chemnitz, Kreisfreie Stadt",
"stage": "production",
"id_name": "Chemnitz, Kreisfreie Stadt",
"stage": "Production",
"num_users": 1,
"country_code": "DE"
},
{
"common_name": "Dresden",
"nuts_lvl3": "Dresden, Kreisfreie Stadt",
"stage": "test",
"id_name": "Dresden, Kreisfreie Stadt",
"stage": "Test",
"num_users": 1,
"country_code": "DE"
},
{
"common_name": "Duisburg-Essen",
"nuts_lvl3": "Duisburg, Kreisfreie Stadt",
"stage": "production",
"id_name": "Duisburg, Kreisfreie Stadt",
"stage": "Production",
"num_users": 1,
"country_code": "DE"
},
{
"common_name": "Freiburg",
"nuts_lvl3": "Freiburg im Breisgau, Stadtkreis",
"stage": "test",
"id_name": "Freiburg im Breisgau, Stadtkreis",
"stage": "Test",
"num_users": 1,
"country_code": "DE"
},
{
"common_name": "Greifswald",
"nuts_lvl3": "Vorpommern-Greifswald",
"stage": "production",
"id_name": "Vorpommern-Greifswald",
"stage": "Production",
"num_users": 1,
"country_code": "DE"
},
{
"common_name": "Heidelberg",
"nuts_lvl3": "Heidelberg, Stadtkreis",
"stage": "production",
"id_name": "Heidelberg, Stadtkreis",
"stage": "Production",
"num_users": 1,
"country_code": "DE"
},
{
"common_name": "Jena",
"nuts_lvl3": "Jena, Kreisfreie Stadt",
"stage": "production",
"id_name": "Jena, Kreisfreie Stadt",
"stage": "Production",
"num_users": 1,
"country_code": "DE"
},
{
"common_name": "Kaiserslautern",
"nuts_lvl3": "Kaiserslautern, Kreisfreie Stadt",
"stage": "production",
"id_name": "Kaiserslautern, Kreisfreie Stadt",
"stage": "Production",
"num_users": 1,
"country_code": "DE"
},
{
"common_name": "Karlsruhe",
"nuts_lvl3": "Karlsruhe, Stadtkreis",
"stage": "mixed",
"id_name": "Karlsruhe, Stadtkreis",
"stage": "Mixed",
"num_users": 5,
"country_code": "DE"
},
{
"common_name": "Kiel",
"nuts_lvl3": "Kiel, Kreisfreie Stadt",
"stage": "test",
"id_name": "Kiel, Kreisfreie Stadt",
"stage": "Test",
"num_users": 1,
"country_code": "DE"
},
{
"common_name": "Köln",
"nuts_lvl3": "Köln, Kreisfreie Stadt",
"stage": "test",
"common_name": "Colonge",
"id_name": "Köln, Kreisfreie Stadt",
"stage": "Test",
"num_users": 1,
"country_code": "DE"
},
{
"common_name": "Mainz",
"nuts_lvl3": "Mainz, Kreisfreie Stadt",
"stage": "test",
"id_name": "Mainz, Kreisfreie Stadt",
"stage": "Test",
"num_users": 1,
"country_code": "DE"
},
{
"common_name": "Munich",
"nuts_lvl3": "München, Kreisfreie Stadt",
"stage": "mixed",
"id_name": "München, Kreisfreie Stadt",
"stage": "Mixed",
"num_users": 1,
"country_code": "DE"
},
{
"common_name": "Paderborn",
"nuts_lvl3": "Paderborn",
"stage": "production",
"id_name": "Paderborn",
"stage": "Production",
"num_users": 1,
"country_code": "DE"
},
{
"common_name": "Stuttgart",
"nuts_lvl3": "Stuttgart, Stadtkreis",
"stage": "production",
"id_name": "Stuttgart, Stadtkreis",
"stage": "Production",
"num_users": 2,
"country_code": "DE"
},
{
"common_name": "Ulm",
"nuts_lvl3": "Ulm, Stadtkreis",
"stage": "planned",
"id_name": "Ulm, Stadtkreis",
"stage": "Planned",
"num_users": 1,
"country_code": "DE"
},
{
"common_name": "Würzburg",
"nuts_lvl3": "Würzburg, Kreisfreie Stadt",
"stage": "production",
"id_name": "Würzburg, Kreisfreie Stadt",
"stage": "Production",
"num_users": 1,
"country_code": "DE"
},
{
"common_name": "Barcelona",
"id_name": "Barcelona",
"stage": "Production",
"num_users": 1,
"country_code": "ES"
},
{
"common_name": "Grenoble",
"id_name": "Isère",
"stage": "Production",
"num_users": 1,
"country_code": "FR"
},
{
"common_name": "Nijmegen",
"id_name": "Arnhem/Nijmegen",
"stage": "Production",
"num_users": 1,
"country_code": "NL"
},
{
"common_name": "Utrecht",
"id_name": "Utrecht",
"stage": "Planned",
"num_users": 1,
"country_code": "NL"
},
{
"common_name": "Chennai",
"id_name": "Chennai",
"stage": "Planned",
"num_users": 1,
"country_code": "IN"
}
]
]
10 changes: 3 additions & 7 deletions data/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@
</style>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<!-- import Leaflet -->
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha256-kLaT2GOSpHechhsozzB+flnD+zUyjE2LlfWPgU04xyI=" crossorigin="" />
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"
integrity="sha256-WBkoXOwTeyKclOHuWtc+i2uENFpDZ9YPdf5Hf+D7ewM=" crossorigin=""></script>
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<!-- Leaflet styling i.e. full page -->
<style>
#map {
Expand Down Expand Up @@ -60,13 +58,12 @@
var map = L.map(
"map",
{
crs: L.CRS.EPSG3857,
zoom: $STARTZOOM$,
zoomControl: true,
preferCanvas: false,
}
);
map.fitBounds([[$LATMIN$, $LONMIN$], [$LATMAX$, $LONMAX$]])
map.fitBounds([[$LONMIN$, $LATMIN$], [$LONMAX$, $LATMAX$]])

var tiles = L.tileLayer(
"https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png",
Expand All @@ -76,7 +73,6 @@
}
).addTo(map);
// $MARKERS-GO-HERE$
// $POLYLINES-GO-HERE$
// $LAYERCONTROL-GO-HERE$
var legend = L.control({ position: 'bottomleft' });
legend.onAdd = function (map) {
Expand Down
5 changes: 3 additions & 2 deletions download_prerequistes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ cd data
# download and save the font
wget -N https://github.com/googlefonts/opensans/raw/main/fonts/ttf/OpenSans-Bold.ttf
# download and save the topojson files
wget -N https://gisco-services.ec.europa.eu/distribution/v2/nuts/topojson/NUTS_RG_01M_2021_3035_LEVL_1.json
wget -N https://gisco-services.ec.europa.eu/distribution/v2/nuts/topojson/NUTS_RG_01M_2021_3035_LEVL_3.json
wget -N https://gisco-services.ec.europa.eu/distribution/v2/nuts/geojson/NUTS_RG_01M_2021_4326_LEVL_1.geojson
wget -N https://gisco-services.ec.europa.eu/distribution/v2/nuts/geojson/NUTS_RG_01M_2021_4326_LEVL_3.geojson
wget -N https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_10m_populated_places_simple.geojson
Loading

0 comments on commit 3317e97

Please sign in to comment.