OpenStreetMaps
Back to Data Sources
Open Street Maps
https://planet.openstreetmap.org/ https://towardsdatascience.com/how-to-read-osm-data-with-duckdb-ffeb15197390
The OpenStreetMap (OSM), and in particular the dataset underlying the map, is a collaborative effort to create a free and editable map of the world. It’s efforts aim to capture the geographic position and assosiated metadata of locations and assets like buildings and roads contributed by volunteers. Novel or otherwise noteworthy aspects of this dataset include it’s open nature and reuse license (Anyone can access and use the data under the Open Data Commons Open Database License (ODbL)). It also has global coverage and covers a number of different asset types, as opposed to something like OpenAddresses which is more US-centric and oriented towards address points. There are a number of ways to access this data including:
OpenStreetMap (OSM) is a collaborative project to create a free, editable map of the world. It is arguably the most prominent example of Volunteered Geographic Information (VGI).
The dataset captures geographic positions and associated metadata of assets ranging from highways and buildings to hiking trails and coffee shops. Unlike proprietary datasets, OSM is defined by its:
- Open License: Data is available under the Open Data Commons Open Database License (ODbL).
- Global Coverage: A single schema applied worldwide (though tagging conventions can vary locally).
- Richness: It often contains data layer types (pedestrian paths, cycleways) that commercial providers ignore.
Data Structure
To effectively use OSM in R, it helps to understand the three core elements: 1. Nodes: Points in space (coordinates). Used for POIs or defining the shape of lines. 2. Ways: Ordered lists of nodes. Open ways are lines (roads, streams); closed ways are polygons (buildings, parks). 3. Relations: Groups of nodes, ways, or other relations. Used for complex logical connections (e.g., a bus route consisting of many road segments).
The R Ecosystem for OSM
While there are many tools to access OSM, the R ecosystem provides several targeted packages:
| Package | Best For |
|---|---|
| osmextract | High Volume. Downloading and reading large .pbf files (e.g., whole states or countries). It uses GDAL/SQL logic to keep memory usage low. |
| osmdata | Precision. querying the Overpass API for small, specific datasets (e.g., “all cafes in downtown Seattle”). |
| OSMnx | Network Analysis. A Python library, but often used alongside R via reticulate for topology cleaning and street network analysis. |