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
450 changes: 0 additions & 450 deletions GrowBikeMVP.ipynb

This file was deleted.

21 changes: 20 additions & 1 deletion docs/source/reference_developer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,30 @@ growbikenet.growbikenet
.. automodule:: growbikenet.growbikenet
:members:

growbikenet.constants
---------------------

.. automodule:: growbikenet.constants
:members:
:private-members:

growbikenet.functions
---------------------

.. automodule:: growbikenet.functions
:members:
:private-members:


growbikenet.settings
--------------------

.. automodule:: growbikenet.settings
:members:
:private-members:

growbikenet.visualization
-------------------------

.. automodule:: growbikenet.visualization
:members:
:private-members:
9 changes: 9 additions & 0 deletions docs/source/reference_user.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,14 @@ This is the user reference for the GrowBikeNet package. If you are looking for a

The standard way to import the GrowBikeNet package is via ``import growbikenet as gbn``. The main ``growbikenet()`` function below is then called via ``gbn.growbikenet()``, see the :doc:`mwe`.

growbikenet.growbikenet
-----------------------

.. automodule:: growbikenet.growbikenet
:members:

growbikenet.settings
--------------------

.. automodule:: growbikenet.settings
:members:
4 changes: 2 additions & 2 deletions docs/source/usage_02_network_growth.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"id": "2b9fb396-327e-43dc-8ef2-2794675b63b1",
"metadata": {},
"source": [
"**Parameters covered**: `ranking`, `allow_edge_overlaps`, `crs_projected`"
"**Parameters covered**: `ranking`, `allow_edge_overlaps`"
]
},
{
Expand Down Expand Up @@ -128,7 +128,7 @@
"source": [
"They are: \n",
"- **betweenness_centrality**: The metric to rank edges by.\n",
"- **geometry**: The geometries of the edges connecting source and target seed points, projected in the coordinate references system (crs) given by the parameter `crs_projected`, rounded to meters. The coordinates correspond to the easting and northing in the crs. These geometries are typically a mix between linestrings and multilinestrings. \n",
"- **geometry**: The geometries of the edges connecting source and target seed points, projected in the coordinate references system (crs) given by the setting `settings.crs_projected`, rounded to meters. The coordinates correspond to the easting and northing in the crs. These geometries are typically a mix between linestrings and multilinestrings. \n",
"- **source**, **target**: The OSM IDs of source and target seed points. These are nodes that can be looked up on OSM, for example for OSM ID 11037313412: https://www.openstreetmap.org/node/11037313412\n",
"- **rank**: The rank which orders the edge by betweenness centrality. These are increasing integers, but not necessarily consecutive, due to potentially empty pieces in-between that are removed due to edge overlaps, see end of this notebook.\n",
"- **length**: Length of the current edge, rounded to whole meters.\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/source/usage_04_data_export_and_visualization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"id": "2540d64c-d30f-4f7a-bd7b-0366358401e6",
"metadata": {},
"source": [
"**Parameters covered**: `export_data`, `export_file_format`, `city_name`, `export_data_slug`, `export_plots`, `export_video`, `crs_projected`"
"**Parameters covered**: `export_data`, `export_file_format`, `city_name`, `export_data_slug`, `export_plots`, `export_video`"
]
},
{
Expand Down
49 changes: 38 additions & 11 deletions growbikenet/constants.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
'''Constants for growbikenet.'''
"""Global constants for growbikenet that can be tweaked during development, but should not be changed later by the user.

PBI_CUSTOM_FILTER : list[str]
Custom filter for protected bicycle infrastructure (pbi)
PRESET_TAGS : dict
Pre-defined tags to select tags as seed points
PHI_LIMITS : list[float]
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 [3]_ (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.
EXISTING_NETWORK_MINIMUM_COMPONENT_LENGTH : int
Minimum length a bike network component needs to have for seed points to snap, in meters
SEED_POINT_SNAP_DISTANCE_FACTOR : float
Factor to multiply seed_point_grid_spacing with, to determine auto value of seed_point_snap_distance
EXISTING_NETWORK_SPACING_FACTOR : float
Factor to multiply seed_point_grid_spacing with, to determine auto value of existing_network_spacing
GRID_SPACING_TRIANGULATE : int
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
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
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).
BUFFER_SEED_POINTS_EXNW_FACTOR : float
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
Number of bins to determine bearing. e.g. 72 will create 5 degrees bins
"""

# Custom filter for protected bicycle infrastructure (pbi)
PBI_CUSTOM_FILTER = ['["cycleway"~"track"]',
'["highway"~"cycleway"]',
'["highway"~"path"]["bicycle"~"designated"]',
Expand All @@ -20,21 +44,24 @@
if custom_tag not in ox.settings.useful_tags_way:
ox.settings.useful_tags_way.extend(custom_tag)


# Pre-defined tags to select tags as seed points
PRESET_TAGS = {
"rail": {"railway": ["station", "halt"]},
"school": {"amenity": ["kindergarten", "school", "college", "university"]},
"park": {"leisure": ["park", "garden", "nature_reserve", "bathing_place"]},
}


# 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 [3]_ (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.
PHI_LIMITS = [0.02, 0.08] # Tercile limits in the paper: 0.033, 0.161


# Minimum length a bike network component needs to have for seed points to snap
EXISTING_NETWORK_MINIMUM_COMPONENT_LENGTH = 100

SEED_POINT_SNAP_DISTANCE_FACTOR = 0.25

EXISTING_NETWORK_SPACING_FACTOR = 0.5

GRID_SPACING_TRIANGULATE = 1707 # a=2b/(2-sqrt(2))
GRID_SPACING_QUADRANGULATE = 1000 # a=2b
GRID_SPACING_TRIANGLE = 1154 # h/2=b=a*sqrt(3)/4 -> a=4b/sqrt(3)

BUFFER_SEED_POINTS_EXNW_FACTOR = 0.5

BEARING_BINS = 72
Loading
Loading