You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm starting to use your excellent package but I found that it download the whole information, consuming too much RAM. I just need osm_lines with the attributes "highway" and "maxspeed".
Is it possible to do that?
Thanks!
# gCO is just a spatial feature object
q0 <- opq(bbox = st_bbox(gCO))
q1 <- add_osm_feature(q0, key = 'name')
x <- osmdata_sf(q1)
osm <- x$osm_lines[, c("highway", "maxspeed")]
st <- c("motorway", "motorway_link", "trunk", "trunk_link",
"primary", "primary_link", "secondary", "secondary_link",
"tertiary", "tertiary_link")
osm <- osm[osm$highway %in% st, ]
Thanks for using the package. As you discovered, using add_osm_feature(key = "highway") is the best way to restrict to highways alone. The package is intentionally designed not to allow restricting to osm_lines alone, rather to return all OSM data associated with a given query. In your example, highways are made of points, so those are returned as osm_points, often with additional data, and highways may also form defined polygons, or higher-level multi-way entities ($osm_multiline).
You can also easily pipe queries to make them possibly more elegant, so the above could be written
I'm starting to use your excellent package but I found that it download the whole information, consuming too much RAM. I just need osm_lines with the attributes "highway" and "maxspeed".
Is it possible to do that?
Thanks!
My sessionInfo:
And my screenfetch
Thanks!
The text was updated successfully, but these errors were encountered: