Skip to content

Commit 0b09540

Browse files
committed
Add pyrosm example
1 parent aa6d3e4 commit 0b09540

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

osm.qmd

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,41 @@ knitr::kable(size_df)
305305

306306
# Other command line tools for working with OSM data {#sec-command-line}
307307

308-
...
308+
## pyrosm
309+
310+
Install the Python package `pyrosm` as follows:
311+
312+
```bash
313+
pip install pyrosm
314+
```
315+
316+
```{r}
317+
#| include: false
318+
# Install pyrosm if not already installed:
319+
# Installed Python packages:
320+
py_pkgs = reticulate::py_list_packages()
321+
py_pkg_names = py_pkgs$package
322+
if (!"pyrosm" %in% py_pkg_names) {
323+
reticulate::py_install("pyrosm")
324+
}
325+
```
326+
327+
Search for Poznan in extracts available from `pyrosm` as follows (note: this fails for me currently):
328+
329+
```{python}
330+
#| eval: false
331+
import pyrosm
332+
from pyrosm import OSM
333+
import geopandas as gpd
334+
335+
poznan_file = pyrosm.get_data("Poznan")
336+
osm = OSM(poznan_file)
337+
poznan_cycling = osm.get_network(network_type="cycling")
338+
poznan_cycling.plot()
339+
```
340+
341+
```{r}
342+
```
309343

310344
# Ideas for using OSM data {#sec-ideas}
311345

0 commit comments

Comments
 (0)