Usage | 1. Seed points¶
This notebook explains the seed points concept behind GrowBikeNet with illustrative examples.
Parameters covered: seed_point_type, seed_point_linking, import_files['seed_points'], seed_point_grid_spacing, seed_point_tags
We start every Usage notebook with the standard way of importing GrowBikeNet:
import growbikenet as gbn
Network construction through linking seed points¶
GrowBikeNet is based on the idea of linking seed points, inspired by the Dutch CROW Design manual for bicycle traffic. These are points in a city that shall be connected by protected bicycle infrastructure, yielding edges in a bicycle network. The choice and placement of seed points is crucial: To build a well-covering bicycle network, seed points should cover most of the city. By default, in GrowBikeNet seed points are arbitrary, city-spanning points on a grid, snapped to the street network, but it is also possible to assign actual points of interests such as railway stations, schools, or parks, see Preset seed points. The seed_point_type parameter is controlling the type of seed points chosen.

Once seed points are defined, they need to be linked. The type of linking is controlled by the seed_point_linking parameter. By default, GrowBikeNet triangulates or quadrangulates the seed points automatically, building triangle or square-shaped links between the seed points. Once the linking process is finished (triangulation or quadrangulation), an abstract, unrouted network between seed points is established, see the figure above. GrowBikeNet then builds a bicycle network on this network’s edges, routed on the street network. Run the cells below for live examples of this process.
Triangulation versus quadrangulation¶
This section explores the utility of the seed_point_type and seed_point_linking parameters. By default, GrowBikeNet detects automatically the optimal type and spacing of the seed point grid, and of the seed point linking process for a given city:
Many European cities like Berlin or London have very irregular, organic street networks. On these networks, GrowBikeNet constructs by default a triangular grid (
seed_point_type=='grid_triangle') that it naturally triangulates (seed_point_linking=='triangulate_delaunay').Some cities like Prague or Budapest have some square grid elements. On these networks, GrowBikeNet constructs by default a square grid (
seed_point_type=='grid_square') that it triangulates (seed_point_linking=='triangulate_delaunay').Many US cities, and some European cities, like Manhattan or Barcelona, have ample grid elements in their street networks. On these networks, GrowBikeNet constructs by default a square grid (
seed_point_type=='grid_square') that it quadrangulates (seed_point_linking=='quadrangulate').
See below the quadrangulated square grid result for Barcelona, Spain:
edges_ordered = gbn.growbikenet("Barcelona")
Under the hood, GrowBikeNet downloads the street network data from OpenStreetMap (OSM) via OSMnx.
Explore the results interactively:
edges_ordered.explore(tiles="CartoDB Positron",
style_kwds={"weight": 3, "color": "#096a51"},)
Compare this to the output if we were to instruct GrowBikeNet to instead triangulate on the square grid instead of quadrangulate. It features some ugly zig-zags:
edges_ordered = gbn.growbikenet("Barcelona",
seed_point_linking ='triangulate_delaunay',)
edges_ordered.explore(tiles="CartoDB Positron",
style_kwds={"weight": 3, "color": "#096a51"},)
Under the hood, GrowBikeNet also automatically adapts the spacing of the seed point grid.
Spacing of the seed point grid¶
In the above network outputs, observe how the grid is more finegrained in the quadrangulation than in the triangulation. This is because by default, seed_point_grid_spacing is set to auto, leading GrowBikeNet to automatically adjust the grid spacing to ensure that any point in the city is always within 500m of the network, on average less than 200m (under perfect conditions). Concretely, the spacing of seed points is every 1707m in the triangulation case, but ony 1000m in the quadrangulation case.
Let’s get back to the nice quadrangulated square grid of Barcelona. As a big part of the city has a square grid structure, each 3x3 block could be considered as a “superblock”, with a bike network going around it. Let us now try to choose a spacing manually that will create this network:
edges_ordered = gbn.growbikenet("Barcelona",
seed_point_grid_spacing=400,)
A spacing of 400m is tighter, but fits the “superblocks” nicer - zoom into the map to see the details:
edges_ordered.explore(tiles="CartoDB Positron",
style_kwds={"weight": 3, "color": "#096a51"},)
Preset seed points¶
Apart from connecting street intersection seed points from an arbitrary grid, GrowBikeNet also supports connecting seed points that are actual points of interests like rail stations, schools, or parks. Points of interests that are not given as point objects are discarded.
Rail¶
The rail option selects all rail stations and halts.
edges_ordered = gbn.growbikenet("Barcelona",
seed_point_type="rail",)
edges_ordered.explore(tiles="CartoDB Positron",
style_kwds={"weight": 3, "color": "#096a51"},)
School¶
The school option selects all kindergardens, schools, colleges, and universities.
edges_ordered = gbn.growbikenet("Barcelona",
seed_point_type="school",)
edges_ordered.explore(tiles="CartoDB Positron",
style_kwds={"weight": 3, "color": "#096a51"},)
Park¶
The park option selects all parks, gardens, nature reserves, and public bathing places. In many cities, including Barcelona, this does not work as well as expected, because such points of interests are often encoded in OSM as polygons and not as points.
edges_ordered = gbn.growbikenet("Barcelona",
seed_point_type="park",)
edges_ordered.explore(tiles="CartoDB Positron",
style_kwds={"weight": 3, "color": "#096a51"},)
Custom seed points¶
File¶
Seed points can be completely custom, for example loaded from file. Here, we first save the coordinates of a bunch of touristic spots in Barcelona as gpkg file, to then load it via the import_files parameter to construct a bicycle network around them:
edges_ordered = gbn.growbikenet(
"Barcelona",
seed_point_type="file",
import_files={"seed_points":"Barcelona_touristic_spots.gpkg"},
)
edges_ordered.explore(tiles="CartoDB Positron",
style_kwds={"weight": 3, "color": "#096a51"})