Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] allow oe_read and oe_vectortranslate to work with .osm files #281

Closed
Robinlovelace opened this issue May 7, 2023 · 5 comments
Closed
Assignees

Comments

@Robinlovelace
Copy link
Member

As illustrated in the example below.

#| echo: false
#| eval: false
leeds_university = tmaptools::geocode_OSM("university of leeds", as.sf = TRUE)
leeds_smallarea = stplanr::geo_buffer(shp = leeds_university, dist = 1000)
dir.create("example-data")
leeds_bounding_polygon = stplanr::bb2poly(sf::st_bbox(leeds_smallarea))
sf::write_sf(leeds_bounding_polygon, "example-data/leeds_bounding_polygon.geojson")
sf::st_bbox(leeds_smallarea)

OSM data was downloaded from overpass with the following command which uses wget to query the API for the bounding box:

 #| eval: false
wget -O example-data/leeds.osm "https://overpass-api.de/api/interpreter?data=[out:xml][timeout:25];(way[highway](53.797790,-1.571467,53.815759,-1.541108);node(w););out body;>;out skel qt;"

The output of the command above can be found in the example-data folder of this repo.

Quietness

A GeoJSON file with quietness estimates for each road segment in Leeds is available at https://github.com/ITSLeeds/cyclability/raw/main/cyclestreets/leeds_quietness.geojson and is illustrated below:

leeds_quietness = sf::read_sf("https://github.com/ITSLeeds/cyclability/raw/main/cyclestreets/leeds_quietness.geojson")
plot(leeds_quietness["quietness"])
leeds_quietness |>
  sf::st_drop_geometry() |>
  dplyr::slice(1:3) |>
  knitr::kable()
leeds_osm = sf::read_sf("example-data/leeds.osm")
leeds_osm = osmextract::oe_read("example-data/leeds.osm")
osmextract::oe_vectortranslate("example-data/leeds.osm")
@agila5 agila5 self-assigned this May 7, 2023
agila5 added a commit that referenced this issue May 7, 2023
@agila5
Copy link
Collaborator

agila5 commented May 7, 2023

Hi Robin, should be fixed by aafd0e4. Please double-check. I will leave this open since I still need to update docs and tests. The warnings will be fixed when I start working on #275.

@Robinlovelace
Copy link
Member Author

Great work Andrea 🔥 will test now...

@Robinlovelace
Copy link
Member Author

I'm excited by this because it opens-up possiblities of reducing reliance on providers and going directly to overpass-api.de for any size, shape and characteristics of data that people need.

robinlovelace-ate added a commit to acteng/cyclability that referenced this issue May 7, 2023
@Robinlovelace
Copy link
Member Author

Confirmed. It works. See reproducible example in the code committed above. Thoughts on adding a simple interface to the overpass API now this works @agila5? Impressed how little effort that was, high boom for buck!

@agila5 agila5 reopened this May 10, 2023
@agila5
Copy link
Collaborator

agila5 commented May 10, 2023

Thoughts on adding a simple interface to the overpass API now this works

We can certainly open a new issue to keep track of that idea but I'm not sure that it is worth the effort since I would just use osmdata 📦 in that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants