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
34 changes: 24 additions & 10 deletions examples/development.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,32 @@

import fixbikenet as fbn

fbn.settings.import_path = '../dataexport/cities/cityexport/'
# fbn.settings.import_path = '/Users/mszell/Tresorit/bikenetkitshare/'
fbn.constants._BETWEENNESS_RANDOM_NODES = 100
fbn.settings.export_file_format = 'geojson'
fbn.settings.export_file_format = 'gpkg'
fbn.constants._ROUTING_PENALTY = {0: 1.5, 1: 1}

city = "paris_fr"

gaps = fbn.fixbikenet(
city_query = city,
import_files = {
'city_boundary': 'boundaries/'+city+'.geojson',
'street_network': 'streetbike_networks/'+city+'.gpkg',
},
)

fbn.fixbikenet(
city_query="Frederiksberg",
radius = 1000,
mingap = 0,
maxgap = 500,
numgaps = 20,
import_files={
'city_boundary': "./tests/test_data/frederiksberg_boundary.geojson",
'street_network': "./tests/test_data/frederiksberg_streetbike_network.gpkg",
},
)

# city = "frederiksberg_dk"
# gaps = fbn.fixbikenet(
# city_query = city,
# import_files = {
# 'city_boundary': 'boundaries/'+city+'.geojson',
# 'street_network': 'streetbike_networks/'+city+'.gpkg',
# },
# )

# data is saved in directory ./results
11 changes: 10 additions & 1 deletion fixbikenet/fixbikenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,16 @@ def fixbikenet(
progress_bar.update(1)
progress_bar.close()

# Cleanup
keepedgedata = ['length', 'geometry']
keepgapdata = ['source', 'target', 'benefit', 'name', 'ordering', 'length', 'geometry']
for p in edges_pbi_gdf.keys():
if p not in keepedgedata:
del edges_pbi_gdf[p]
for p in gaps_ordered.keys():
if p not in keepgapdata:
del gaps_ordered[p]

# Generate export data filename
if export_data:
os.makedirs(settings.export_path, exist_ok=True)
Expand All @@ -228,7 +238,6 @@ def fixbikenet(
)

if export_data:
edges_pbi_gdf.drop(["osmid"], axis=1, inplace=True)
edges_gdf.drop(["osmid"], axis=1, inplace=True)
city_boundary.to_crs(epsg=4326, inplace=True)
if settings.export_file_format == "geojson":
Expand Down
Binary file modified tests/test_data/frederiksberg-fixbikenet-gaps.gpkg
Binary file not shown.
Loading