UrbanAnalyst / dodgr

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

Method to download data #128

Closed rafapereirabr closed 4 years ago

rafapereirabr commented 4 years ago

Hi Mark,

Is it appropriate to do routing analysis and get network distances on road data downloaded using this code snippet ?

dat_sc <- osmdata::opq(bbox = bb) %>%
    add_osm_feature(key = 'highway', value = 'motorway') %>%
    osmdata_sc()

I ask you this because it seems to me that dodgr_streetnet_sc{dodgr} is a wrapper for opq{osmdata}. However, I get really different file sizes when I apply weight_streetnet to road network data downloaded using these two different approaches:

# Download attemp 1 with opq{osmdata}
  dat_sc <- osmdata::opq(bbox = bb) %>%
    add_osm_feature(key = 'highway', value = 'motorway') %>%
    osmdata_sc()

  # # Download attemp 2 with dodgr_streetnet_sc{dodgr}
   dat_sc <- dodgr::dodgr_streetnet_sc(bbox=bb, expand = 0.05, quiet = TRUE)
mpadge commented 4 years ago

Hi Rafael, thanks as always for inquiries. In this case, the direct dodgr code:

  1. Downloads the whole network including every single way, whereas the osmdata code sub-selects only those with value = "motorway", and
  2. Does so for an expanded bounding box (by 1.05 in each direction).

So the dodgr result ends up bigger. The ability of dodgr to download data is really just intended for convenience for people who might not be so savvy with osmdata and/or R in general. No offense, but that's not really you, and you'd be better off always using the explicit osmdata calls for more control. I'll close now, presuming I've correctly interpreted what you meant, but feel free to open if i've misunderstood anything. Cheers!

rafapereirabr commented 4 years ago

Thank you for clarifying this, Mark! For the moment, I only need to do a routing analysis by car so I stick with add_osm_feature(key = 'highway', value = 'motorway') for now. Thanks again !