I am building a Shiny App that uses GTFS feeds and a local Open Trip Planner instance to measure transit access sheds in greater Boston. Currently, I am using a httr:: query to access the LIsochrone API, on the localhost server.
In order for this function to work on shinyapps.io, I need to connect to a remote server.
I already have a Graph Built and the OSM data downloaded for the region of interest. I imagine I can include these in my package of files when I publish the app.
My questions:
(1) Is it possible to run an OTP instance on a Shiny Server?
(2) How would I start up this hypothetical server in my R Code?
(2) What URL do I use to connect to that instance (e.g. for a httr:: or opentripplanner:: query)?
The relevant code is included below, to show the type of workflow I hope to execute. I have already reached out to the MBTA to see if they have an OTP instance I can use instead. That would make things much easier.
observeEvent(input$go, {
lat <- input$mymap_click$lat ##user click
lng <- input$mymap_click$lng ##user click
current <- GET(
"http://localhost:8080/otp/routers/mbta/isochrone", ##THIS IS THE URL I HOPE TO EDIT
query = list(
toPlace = "53.3627432,-2.2729342",
fromPlace = paste(lat,lng,sep = ","), # latlong of place
mode = paste(input$modes, collapse = ","), # modes we want the route planner to use
date = "10-22-2020",
time= paste0(input$hh,":",input$mm,input$am_pm),
maxTimeSec = as.numeric(input$mins)*60,
maxWalkDistance = (as.numeric(input$walk)*1609.344), #convert mile input to metres
walkReluctance = 5,
minTransferTime = (as.numeric(input$transfer)*60),
wheelchair = input$wheelchair,
maxTransfers = input$max_transfer, # in secs
cutoffSec = 900,
cutoffSec = 1800,
cutoffSec = 2700,
cutoffSec = 3600)
)
current_content <- content(current, as = "text", encoding = "UTF-8")
iso <- st_read(current_content ) %>% st_transform(4326)