How to specify which columns from OSM files are read by st_read? · Issue #1157 · r-spatial/sf (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Description
I have tried to load some data in pbf format downloaded from geofabrik and I want to specify which columns to create (specifically "oneway" and "maxspeed") while sf is reading the file into R.
This is what I have tried with @Robinlovelace (and it works only on Linux but not on windows) but we don't know how to modify the .ini file in a reproducible way or even point GDAL to a different .ini file (https://gdal.org/drivers/vector/osm.html).
See below for "reproducible" example
wy_url = "http://download.geofabrik.de/europe/great-britain/england/west-yorkshire-latest.osm.pbf" download.file(wy_url, "wy.osm.pbf") sf::st_layers("wy.osm.pbf") roads_country = sf::read_sf("wy.osm.pbf", layer = "lines") roads_country