Usage | 7. Settings and constants

This notebook explains how to change settings and constants for advanced use, to configure operational details of GrowBikeNet.

Modules covered: settings, constants

We start every Usage notebook with the standard way of importing GrowBikeNet:

import growbikenet as gbn

Settings

The function gbn.growbikenet() is run with several parameters, which are the main “operational settings”. However, there is a longer list of optional settings that can be tuned for maximal configurability. To change a setting settingname to newsettingvalue, do the following before running gbn.growbikenet(): gbn.settings.settingname = newsettingvalue. The correctness of some settings is checked automatically, but not all of them. If you experience strange results or errors, double-check your set settings.

Results and data export

  • crs_result : str, default ‘4326’
    EPSG code of the coordinate reference system for the resulting geodataframe and exported data. If ‘4326’ (WGS84) and export_file_format is set to ‘geojson’, data is exported via the RFC7946 standard.

  • export_path : dict(str)
    Paths to results and plots folders to save data and plots.

  • 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 and city boundary. If exporting as gkpg, these are added all in one file as extra layers.

  • seed_point_type_name : str, default ‘file’
    The name of the seed points in the exported file name, when seed_point_type is set to ‘file’.

  • viz : dict
    Dictionary of visualization settings:

    • ‘bike_to_grow’ : dict
      Dictionary of properties for the bicycle network to grow but not yet grown.

    • ‘bike_grown’ : dict
      Dictionary of properties for the bicycle network grown.

    • ‘bike_existing’ : dict
      Dictionary of properties for the existing bicycle network.

    • ‘seed_point’ : dict
      Dictionary of properties for the seed points. Set ‘markersize’ to 0 to hide them.

    • ‘crs’ : str, default ‘auto’
      The CRS used for plotting. Option ‘auto’ sets a local azimuthal projection centered on the network. Otherwise, for Europe ‘3035’ (LAEA) and globally ‘54035’ (Equal Earth) or ‘54030’ (Robinson) also produce good results.

Data import

  • import_data_impact : float, default 9
    Impact of imported trip or point data on results. Must be non-negative.

  • import_data_trip_point_balance : float, default 0.5
    Impact of imported trip data versus point data on results. Must be between 0 and 1, where 0 means no trip impact and full point impact, 1 means full trip impact and no point impact, and 0.5 means balanced impact of both. If only the trip data is imported, this variable is treated as 1; if only the point data is imported, this variable is treated as 0 - meaning in such a case the data impact is controlled only by settings.import_data_impact.

  • import_path : str
    Path to import files (as defined in growbikenet’s import_files parameter).

  • import_point_data_snap_distance : int, default 500
    Maximum distance between point data and network links for snapping, in meters.

  • import_trip_data_snap_distance : int, default 500
    Maximum distance between trip data and network links for snapping, in meters.

Operation

  • random_seed : int, default 43
    Random number generator seed for reproducibility

  • silent : bool, default False
    If set to True, suppresses all user feedback. Useful for batch exports.

Constants

These are global constants for GrowBikeNet that can be tweaked during development, but should not be changed later by the user. GrowBikeNet still makes them configurable, for maximal configurability. To change a constant constantname to newconstantvalue, do the following before running gbn.growbikenet(): gbn.constants.constantname = newconstantvalue. The correctness of constants is not checked automatically, so if you experience strange results or errors, double-check your set constants.

Custom filters

  • PBI_CUSTOM_FILTER : list[str]
    Custom filter for protected bicycle infrastructure (pbi).

  • GROWABLE_NETWORK_CUSTOM_FILTER : list[str] or None
    Custom filter for all infrastructure elements that are considered as growable by growbikenet. By default, growbikenet uses a custom filter to retrieve the combined drive and pbi (protected bicycle infrastructure) network. To only consider the drive network, set GROWABLE_NETWORK_CUSTOM_FILTER to None and GROWABLE_NETWORK_TYPE to ‘drive’. However, doing so can lead to issues: https://github.com/BikeNetKit/GrowBikeNet/issues/255.

  • GROWABLE_NETWORK_TYPE : {‘drive’, ‘all’, ‘all_public’, ‘bike’, ‘drive_service’, ‘walk’}, default ‘drive’
    What type of street network to retrieve for the growable network if GROWABLE_NETWORK_CUSTOM_FILTER is None.

Operation

  • GRID_SPACING_TRIANGULATE : int, default 1707
    Grid spacing in meters for grid triangulation that ensures that any point in the city is always within buffer distance b=500m of the network (if seed points snap perfectly).

  • GRID_SPACING_QUADRANGULATE : int, default 1000
    Grid spacing in meters for quadrangulation that ensures that any point in the city is always within buffer distance b=500m of the network (if seed points snap perfectly).

  • GRID_SPACING_TRIANGLE : int, default 1154
    Grid spacing in meters for triangle grid that ensures that any point in the city is always within buffer distance b=500m of the network (if seed points snap perfectly).

  • REORDER : bool, default True
    Decision whether ordering should be reordered after edge removal, as edge removal can leave gaps.

Internal / Technical

The following are especially technical or internal constants. To signify this, they start with an underscore.

  • _CRS_CALCULATIONS : str, default ‘3857’
    EPSG code of the coordinate reference system that is used to project OSM data for calculations. The default ‘3857’ is WGS 84 / Pseudo-Mercator. Note that the CRS for plotting is not set here, but in settings.viz['crs'].

  • _PRESET_TAGS : dict
    Pre-defined tags to select tags as seed points

  • _PHI_LIMITS : list[float], default [0.02, 0.08]
    Two orientation order limits between street networks with:

    1. negligible grid elements, 2) some grid elements, 3) grid. We aimed to use the tercile limits from the paper [1]_ (Fig 2), but the values here are lower for unknown reasons, also with the unweighted version. Also, it was aimed to have Barcelona in the grid category. For these reasons, the limits were lowered.

  • _SEED_POINT_SNAP_DISTANCE_FACTOR : float, default 0.25
    Factor to multiply seed_point_grid_spacing with, to determine auto value of seed_point_snap_distance.

  • _EXISTING_NETWORK_SPACING_FACTOR : float, default 0.5
    Factor to multiply seed_point_grid_spacing with, to determine auto value of existing_network_spacing.

  • _BUFFER_SEED_POINTS_EXNW_FACTOR : float, default 0.5
    Factor to multiply existing_network_spacing with, to determine which previously determined seed points (grid or rail) to drop that are too close to the extra existing network points.

  • _BEARING_BINS : int, default 72
    Number of bins to determine bearing. e.g. 72 will create 5 degrees bins.