User reference¶
This is the user reference for the FixBikeNet package. If you are looking for an introduction to FixBikeNet, read the Getting started guide.
The standard way to import the FixBikeNet package is via import fixbikenet as fbn. The main fixbikenet() function below is then called via fbn.fixbikenet(), see the Minimum working example.
fixbikenet.fixbikenet¶
Main procedure for running fixbikenet.
- fixbikenet.fixbikenet.fixbikenet(city_query, min_gap_length=20, max_gap_length=800, num_gaps=50, export_data=True, city_id=None, export_plot=False, import_files={})[source]¶
Find gaps in bicycle networks and return the num_gaps that are the most important to fill.
- Parameters:
- city_querystr
Name of the city that the analysis should be performed on.
- min_gap_lengthint, default 20
Minimum distance between node pairs to be considered as a potential gap, in meters.
- max_gap_lengthint, default 800
Maximum distance between node pairs to be considered as a potential gap, in meters.
- num_gapsint, default 50
Number of gaps to find.
- export_databool, default True
If set to True, data will be saved to a file. The filename is [slug].[settings.export_file_format], where slug is a string id made out of city_query (or city_id if set).
- city_idstr | None, default None
If set, the slugified city_id is used in the filename of the data export. For example, a city_id “Athens” will slugify into “athens” in filenames. If set to None, the slugified city_query is used in the filename of the data export. It is useful to set a city_id for cities where the city_query is not the city name, for example to set for a city_query “Municipality of Athens” the city_id to “Athens”.
- export_plotbool, optional, default False
If set to True, plot will be saved to a file.
- import_files: dict, default {}
The following key:value entries can be set:
- ‘city_boundary’None or str, default None
If not set to None, the study area is selected from the (Multi)Polygon provided in the city_boundary shape or gpkg file, ideally in unprojected latitude-longitude degrees (EPSG:4326), but EPSG:3857 also works.
- ‘street_network’str | None, default None
If not set to None, the street network is loaded from this file. For best results, this network should encompass both car and protected bicycle infrastructure. Must be a gpkg file in unprojected crs EPSG:4326 with layers nodes and edges, with the structure that an undirected osmnx street network g has after saved via ox.io.save_graph_geopackage(). For example: >>> import fixbikenet as fbn >>> g = ox.graph_from_place(“Barcelona”, simplify=False, retain_all=True, custom_filter = fbn.osm.CARPBI_NETWORK_CUSTOM_FILTER) >>> g = nx.MultiGraph(ox.convert.to_digraph(g)) >>> ox.io.save_graph_geopackage(g, “Barcelona_carpbi_network.gpkg”).
- ‘point_data’None or str, default None
If not set to None, an additional data set of points will be loaded from this file, representing point events like traffic crashes or citizen feedback to improve bike infrastructure. Must be a gpkg or geojson file in unprojected CRS EPSG:4326 containing only point objects, optionally with an int
numcolumn that encodes the number of point events. The data set is used to re-prioritize the ordering of the network gaps, controlled with settings.import_data_impact.
- Returns:
- gaps_orderedgeopandas.geodataframe.GeoDataFrame
Ordered geodataframe with the num_gaps most important gaps to fill.
References
[1] Vybornova, A., Cunha, T., Gühnemann, A. and Szell, M. (2023), Automated Detection of Missing Links in Bicycle Networks. Geogr Anal, 55: 239-267. https://doi.org/10.1111/gean.12324
fixbikenet.settings¶
Global settings for fixbikenet that can be configured by the user.
- export_file_format{‘gpkg’, ‘geojson’}, default ‘gpkg’
File format for the data export, relevant if export_data is set to True. If exporting as geojson, generates extra files for seed points, city boundary, and existing bicycle network (if relevant). If exporting as gkpg, these are added all in one file as extra layers.
- export_pathdict(str)
Paths to results folder to save data.
- import_data_impactfloat, default 10000
Impact of imported trip or point data on results. Must be non-negative.
- import_point_data_snap_distanceint, default 100
Maximum distance between point data and network links for snapping, in meters.
- import_pathstr
Path to import files (as defined in fixbikenet’s import_files parameter).
- radiusint, default 2500
Cut-off length for computation of local betweenness centrality, in meters.
- random_seedint, default 43
Random number generator seed for reproducibility
- silentbool, default False
If set to True, suppresses all user feedback. Useful for batch exports.
fixbikenet.osm¶
Global constants for fixbikenet related to OpenStreetMap (OSM). These are meant for advanced users only who have a good understanding of OSM tags.
- CARPBI_NETWORK_CUSTOM_FILTERlist[str] or None
Custom filter for all infrastructure elements that are the combined drive and pbi (protected bicycle infrastructure) network. By default, CARPBI_NETWORK_CUSTOM_FILTER is a superset of PBI_CUSTOM_FILTER, so it is best to keep them in sync.
- PBI_CUSTOM_FILTERlist[str]
Custom filter for protected bicycle infrastructure (pbi). Always keep in sync with PBI_DICT and PBI_DICT_SUB. By default, PBI_CUSTOM_FILTER is a subset of CARPBI_NETWORK_CUSTOM_FILTER, so it is best to keep them in sync.
- PBI_DICTdict
Dictionary for protected bicycle infrastructure (pbi), for single criteria. Always keep in sync with PBI_CUSTOM_FILTER.
- PBI_DICT_SUBdict
Dictionary for protected bicycle infrastructure (pbi), with one sub-criterion. For example, highway~path AND bicycle~designated. Always adds a second criterion access!~private. Always keep in sync with PBI_CUSTOM_FILTER.