Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
data/
plots/
cache/
results/

# Created by https://www.toptal.com/developers/gitignore/api/visualstudiocode,python,macos,windows
# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudiocode,python,macos,windows
Expand Down
2 changes: 2 additions & 0 deletions cities/test_cities.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name_en;country_en;nominatim_query
Copenhagen;Denmark;
17 changes: 17 additions & 0 deletions scripts/growbikenet/batchexport_allcities.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
Script for exporting some growbikenet data for multiple cities.
"""

import pandas as pd
import os
from slugify import slugify

df = pd.read_csv('./cities/european_capitals.csv',
sep = ';',)

for nominatimstring, city_name in zip(list(df.nominatim_query), list(df.name_en)):
if type(nominatimstring) is str:
os.system("python ./scripts/growbikenet/batchexport_onecity.py '"+nominatimstring+"' '"+city_name+"'")
else: # No entry is a nan in a df. Here we need to use a shape file. It must be in the folder cities/
os.system("python ./scripts/growbikenet/batchexport_onecity.py '"+city_name+"' '"+city_name+"'"+" geojson "+"'./cities/"+slugify(city_name)+".shp'")

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Example for exporting some growbikenet data for one city.
Script for exporting some growbikenet data for one city.

Parameters
----------
Expand All @@ -24,13 +24,13 @@

Examples
--------
>>> python exportsomedata_onecity.py Barcelona Barcelona gpkg
>>> python batchexport_onecity.py Barcelona Barcelona gpkg
"""

# WHICH DATA TO EXPORT?
export_seed_point_type = ["grid", "rail"]
export_ranking = ["betweenness_centrality"]
export_existing_network_spacing = [None]
export_seed_point_type = ["grid", "rail"] # Full array: ["grid", "rail"]
export_ranking = ["betweenness_centrality", "closeness_centrality"] # Full array: ["betweenness_centrality", "closeness_centrality", "random""]
export_existing_network_spacing = [None, 500] # Full array: [None, 500]

# Main
import growbikenet as gbn
Expand All @@ -50,17 +50,12 @@
export_file_format = sys.argv[3]
if len(sys.argv) >= 5:
city_boundary_file = sys.argv[4]

print("Exporting " + export_file_format + " data for " + city_name)

export_data_slug = slugify(export_data_slug)

for seed_point_type in export_seed_point_type:
for ranking in export_ranking:
for existing_network_spacing in export_existing_network_spacing:
if existing_network_spacing: existing_network_spacing_string = ", with existing bike network"
else: existing_network_spacing_string = ""
print("\n" + "Exporting " + seed_point_type + ", " + ranking + existing_network_spacing_string)
gbn.growbikenet(
city_name=city_name,
ranking=ranking,
Expand Down
9 changes: 0 additions & 9 deletions scripts/growbikenet/exportalldata_allcities.py

This file was deleted.

69 changes: 0 additions & 69 deletions scripts/growbikenet/exportalldata_onecity.py

This file was deleted.

9 changes: 0 additions & 9 deletions scripts/growbikenet/exportsomedata_allcities.py

This file was deleted.