GIScience / openrouteservice-r

:globe_with_meridians: query openrouteservice API from R
https://giscience.github.io/openrouteservice-r/
101 stars 23 forks source link

strange isochrones result (?) #55

Closed JimShady closed 5 years ago

JimShady commented 5 years ago

I guess this is more an issue with the data source than this package, but I wondered if anyone could shed light on the polygon that is returned from the isochrone result. What I mean by this, is why are there vertices away from roads? If an isochrone is calculating distances that can be travelled along the network, shouldn't the vertices all be on roads? And straight lines between those? Some sample code and scribble below to illustrate my point. Thoughts welcome ... (!)

library('mapview')
library('sf')
library('openrouteservice')
library('osmdata')

routes <- ors_isochrones(c(-0.134722, 51.510115), range = 120,
                       output = 'sf',
                       profile = 'foot-walking')

roads <- opq(bbox = routes) %>%
    add_osm_feature(key = 'highway') %>%
    osmdata_sf()

roads <- roads$osm_lines

mapview(roads) %>%
    addFeatures(routes)

image

HendrikLeuschner commented 5 years ago

Hi, the algorithm building the geometry does simplifications to reduce complexity. Otherwise you'd look at thousands of polygon vertices for larger isochrones. Further, there are some buffer points added, which generally do not correspond to roads. The isochrone algorithm is currently being reworked, including new geometry and better polygons for small scale isochrones.