I am trying to create something based on this Isolines Shiny app.
This uses the Here API. Supposedly it is possible to use public transport and cycling in the Mode
, but when I do this, I get an error:
Isoline API failed with the following error: InvalidInputData
From looking at the documentation public transport and cycling works with routing, but possibly not with isolines.
This is the relevant Shiny code (heavily influenced by the app mentioned above):
is_valid = validate_inputs(session, input$origin, input$departure, input$min, input$max, input$step)
if(is_valid) {
progress$status$set(message = 'Requesting...')
departure = paste0(input$departure, ' ',input$time, ':00:00')
range_type = switch(input$range_type, 'Time (minutes)' = 'time', 'Distance (metres)' = 'distance')
unit = switch(input$range_type, 'Time (minutes)' = ' minutes', 'Distance (metres)' = ' metres')
mode = switch(input$mode, 'Pedestrian' = 'pedestrian', 'Public Transport' = 'publicTransport', 'Bike' = 'bicycle', 'Car' = 'car')
isoline_sequence = if(input$range_type == 'Time (minutes)') {
seq(input$min, input$max, input$step) * 60 %>% sort()
} else {
round(seq(input$min, input$max, input$step), digits = 0) %>% sort()
}
layers = sapply(1:length(isoline_sequence), function(x) {
progress$status$inc(amount = 1/length(isoline_sequence),
message = paste0('Processing request ', x, ' of ', length(isoline_sequence)))
isoline(str_remove(input$origin, ' '), departure = departure, range_type = range_type,
range = isoline_sequence[x], mode = mode, app_id = keys$app_id, app_code = keys$app_code)
})
As at now, the calculate Isoline
API supports only car
, truck
and pedestrian
transport modes.
See documentation:
https://developer.here.com/documentation/routing/topics/resource-calculate-isoline.html:
Types supported in isoline request: fastest, shortest.
TransportModes supported in isoline request: car, truck (only with type fastest), pedestrian.