This package uses the libosmium library in the background and proposes an opinionated way of interacting with raw OSM data. It is opinionated, because a number of assumptions are made, based on a long and sometimes frustrating experience of working with OSM data in R or python projects. The assumptions and the proposed data schema will be covered in a separate vignette. This part will mainly cover the setup of the package.
The usage of cppRosm
relies on the libosmium library. The
necessary compiled code dependencies come with the package, facilitating
it’s use.
Install the package from github:
# remotes::install_github('ischlo/cppRosm')
# devtools::install_github('ischlo/cppRosm')
# pak::pak("ischlo/cppRosm")
Once the library is installed, you will need a OSM extract file, you can get one by manually exporting a selected area from OSM, or for bigger areas, the best approach is to download a geofabrick extract.
This is a early stage development package that could develop more functionalities for integrating the extremely performant osmium library with a user friendly R workflow. The choice has been made for graph data to first export it to .csv files and only after reading it into R. This is to avoid potentially creating files that are to big to be handled by the R environment, while still extracting the data. However, this process can fail sometimes, resulting in loss of unsaved data in the active R environment. Best practices and the optimal workflows are covered in a separate vignette.
There are a few great packages for working with OSM data, they all
provide a wide set of functionalities. If the size of your data is not
excessive, like small city/village scale, osmdata
might be your tool
of choice in R. If the data gets bigger, osmextract
could be the right
choice. This package aims to be both user friendly and flexible, but
also high performing.
language | package |
---|---|
R | osmdata ,osmextract |
python | pydriosm , pyrosm , osmium |