File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -338,7 +338,42 @@ poznan_cycling = osm.get_network(network_type="cycling")
338338poznan_cycling.plot()
339339```
340340
341+ ## osmnx
342+
343+ Install the Python package ` osmnx ` as follows:
344+
345+ ``` bash
346+ pip install osmnx
347+ ```
348+
341349``` {r}
350+ #| include: false
351+ # Install osmnx if not already installed:
352+ # Installed Python packages:
353+ if (!"osmnx" %in% py_pkg_names) {
354+ reticulate::py_install("osmnx")
355+ }
356+ ```
357+
358+
359+ ``` {python}
360+ import osmnx as ox
361+ import geopandas as gpd
362+ # Get cycle netework for Poznan
363+ poznan_polygon = ox.geocode_to_gdf("Poznan, Poland")
364+ poznan_polygon.plot();
365+ ```
366+
367+ Download the cycling network for Poznan as follows:
368+
369+ ``` {python}
370+ poznan_cycle_network = ox.graph_from_polygon(poznan_polygon.geometry[0], network_type="bike")
371+ ```
372+
373+ Plot the results:
374+
375+ ``` {python}
376+ ox.plot_graph(poznan_cycle_network)
342377```
343378
344379# Ideas for using OSM data {#sec-ideas}
You can’t perform that action at this time.
0 commit comments