UrbanAnalyst / dodgr

Distances on Directed Graphs in R
https://urbananalyst.github.io/dodgr/
127 stars 16 forks source link

runtime error when using dodgr_streetnet() #174

Closed LeshunXu closed 2 years ago

LeshunXu commented 2 years ago

Hi, I am new to use dodgr_streetnet() in dodgr package. Does anyone can help me to solve the reported problem? Here is my code:

myNet <- "oxford uk" %>% osmdata::getbb() %>% dodgr_streetnet(., expand=0)

The error I got is:

Error in check_for_error(doc) : General overpass server error; returned: The data included in this document is from www.openstreetmap.org. The data is made available under ODbL. runtime error: Query timed out in "query" at line 3 after 26 seconds.

I appreciate for your help!!

LeshunXu commented 2 years ago

My supervisor and I find a solution. Here is the solution:

myNet <- "oxford uk" %>% osmdata::getbb() %>% t() %>% dodgr_streetnet(., expand=0) or myNet <- "oxford uk" %>% osmdata::getbb() %>% c() %>% dodgr_streetnet(., expand=0)

So, I think, it would be great if add bbox <- t(bbox) before bb <- process_bbox(bbox, pts, expand) in the dodgr_streetnet() function.

mpadge commented 2 years ago

Thanks @LeshunXu - you may be "new" in using dodgr, but you did indeed find a bug! You are supposed to just pass the names of locations directly to the dodgr_streetnet() function, rather than calling osmdata::getbb() yourself, but the code you provide should nevertheless work anyway. The above commit detects when bbox parameters are in the form returned from osmdata::getbb(), and transposes accordingly. Thanks!

MartinLHazelton commented 2 years ago

Thanks @mpadge ! The advantage of getting the bounding box first is that one can subsequently tailor the boundaries to one's requirements.