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 | grid | from scratch
----------------------------------------------╮
Downloading OSM data : 100%|████████████████| 1/1 [01:04<00:00, 64.96s/network]
Creating seed points : 100%|████████████████| 3/3 [00:03<00:00, 1.13s/step]
Triangulation : 100%|████████████████| 2/2 [00:01<00:00, 1.23step/s]
Routing : 100%|████████████████| 2/2 [00:00<00:00, 9.43step/s]
Computing edge metrics : 100%|████████████████| 2/2 [00:00<00:00, 154.27step/s]
Removing edge overlaps : 100%|████████████████| 108/108 [00:00<00:00, 225.11edge/s]
Saving data : 100%|████████████████| 1/1 [00:00<00:00, 22.51step/s]
----------------------------------------------╯
FINISHED IN 0:01:11
==============================================
Explore results¶
See the contents of the resulting geodataframe:
[3]:
edges_ranked.head()
[3]:
| betweenness_centrality | geometry | source | target | ordering_betweenness_centrality | length | length_cumulative | |
|---|---|---|---|---|---|---|---|
| 0 | 0.191026 | LINESTRING (538244 5742744, 538241 5742744, 53... | 11634010250 | 3131502503 | 0 | 3211 | 3211 |
| 1 | 0.151282 | LINESTRING (538244 5742744, 538310 5742754, 53... | 11634010250 | 2483734948 | 1 | 1982 | 5194 |
| 2 | 0.151282 | LINESTRING (540101 5741118, 540099 5741121, 54... | 2483734948 | 12059545689 | 2 | 1837 | 7032 |
| 3 | 0.135897 | LINESTRING (540101 5741118, 540102 5741113, 54... | 11509473800 | 12059545689 | 3 | 2635 | 9667 |
| 4 | 0.132051 | LINESTRING (538244 5742744, 538248 5742705, 53... | 11634010250 | 6967090359 | 4 | 1849 | 11516 |
Explore the results interactively:
[4]:
edges_ranked.explore(tiles="CartoDB Positron", # background map
style_kwds={"weight": 4, "color": "#096a51"}, # thick green lines
)
[4]:
Make this Notebook Trusted to load map: File -> Trust Notebook