marcusyoung / otpr

OpenTripPlanner REST API wrapper for R
Other
31 stars 4 forks source link

cutoffs option in otp_get_isochrome #12

Closed StatistikVolker closed 3 years ago

StatistikVolker commented 3 years ago

Thank you for otpr!

I tried otp_get_isochrone funtion.

Unfortuinately cutoffe less than 330 seconds are not possible. Why?

Especially mode "WALK" it is interessting to know how many persons are covered within a 3-minute walk distance (180s) or 5-Minute distance (300s).

Thank you!

marcusyoung commented 3 years ago

@StatistikVolker Could you clarify what you mean by "not possible"? Do you get an error message?

StatistikVolker commented 3 years ago

O sorry wasn't clear enough:

If I specify the cutoffs = c(180,300,420,600) for example, the calculation runs without error. But:

If I plot the results afterwards, the isochromes for 180s and 300s are not plotted.

Workflow (don't run): I created a local OTP for the area of Jena in Thuringa, Germany first, which you don't have :-(

`my_isochrone <-otpr::otp_get_isochrone( otpcon, location = c(50.9247, 11.578893), fromLocation = TRUE, format = "SF", mode = "WALK", date = "09-30-2020", time = "14:00:00", cutoffs = c(180,300,420,600), batch = TRUE, arriveBy = FALSE, maxWalkDistance = 1000, walkReluctance = 2, transferPenalty = 0, minTransferTime = 0 )

plot using tmap package

set bounding box

class(my_isochrone$response)

bbox <- bb(my_isochrone$response)

get OSM tiles

osm_man <- read_osm(bbox, ext = 1.1)

plot isochrones

tm_shape(osm_man) + tm_rgb() + tm_shape(my_isochrone$response) + tm_fill( col = "time", alpha = 0.3, palette = "-plasma", n = 4, style = "cat", title = "Time (seconds)" ) + tm_layout(legend.position = c("left", "top"), legend.bg.color = "white", main.title = "Walkin to Busstop within 10 minutes", main.title.size = 1.4) `

Is it a little bit claearer now?

marcusyoung commented 3 years ago

@StatistikVolker That probably means that the 180 and 300 isochrones returned by OTP are empty. The latest development version of otpr returns the URL of the query made to OTP. You can then paste that query in a browser and for an isochrone query see the returned GeoJSON file.

The issue may be connected to the resolution of the sampling grid used as discussed here:

https://groups.google.com/g/opentripplanner-users/c/Mva2_rc8TUE/m/3aMtGY_KCgAJ

which also notes that the method "was designed for distances typical of public transportation travel, not walking."

StatistikVolker commented 3 years ago

Thanks - good information.