Note
This page was generated from mwe.ipynb.
Minimum working example¶
This notebook runs a minimum working example with growbikenet.
Import growbikenet¶
The standard way of importing growbikenet:
[1]:
import growbikenet as gbn
Run growbikenet on example city¶
[2]:
edges_ranked = gbn.growbikenet("Lyon")
==============================================
RUNNING GROWBIKENET FOR CITY: Lyon
betweenness_centrality | auto | from scratch
----------------------------------------------╮
Downloading OSM data : 100%|████████████████| 1/1 [00:18<00:00, 18.27s/network]
Creating seed points : 100%|████████████████| 3/3 [00:00<00:00, 7.24step/s]
Triangulation : 100%|████████████████| 1/1 [00:00<00:00, 715.51step/s]
Routing : 100%|████████████████| 3/3 [00:00<00:00, 9.04step/s]
Computing edge metrics : 100%|████████████████| 2/2 [00:00<00:00, 171.64step/s]
Removing edge overlaps : 100%|████████████████| 100/100 [00:00<00:00, 206.40edge/s]
Exporting data : 100%|████████████████| 1/1 [00:00<00:00, 26.08step/s]
----------------------------------------------╯
Data exported to results/
----------------------------------------------
FINISHED IN 0:00:20
==============================================
Explore results¶
See the contents of the resulting geodataframe:
[3]:
edges_ranked.head()
[3]:
| betweenness_centrality | geometry | source | target | rank | length | length_cumulative | |
|---|---|---|---|---|---|---|---|
| 0 | 0.178679 | LINESTRING (538619 5740977, 538546 5740848, 53... | 22147748 | 26058165 | 0 | 2737 | 2737 |
| 1 | 0.120120 | LINESTRING (540094 5741109, 540085 5741108, 54... | 25258525 | 26058165 | 1 | 1718 | 4456 |
| 2 | 0.118619 | LINESTRING (541981 5739635, 541973 5739638, 54... | 25334263 | 25258525 | 2 | 2631 | 7087 |
| 3 | 0.112613 | LINESTRING (538619 5740977, 538626 5740990, 53... | 26106485 | 26058165 | 3 | 2361 | 9449 |
| 4 | 0.105105 | LINESTRING (536613 5740738, 536645 5740703, 53... | 22147748 | 8593425 | 4 | 3316 | 12765 |
Explore the results interactively:
[4]:
edges_ranked.explore(tiles="CartoDB Positron", # background map
style_kwds={"weight": 3, "color": "#096a51"}, # thick green lines
)
[4]:
Make this Notebook Trusted to load map: File -> Trust Notebook
See the Usage docs for detailed explanations.