Hi all,
I have created a new REST API that gives list of available Bus Routes between starting(lat,long) and destination(Lat,Long) using available OneBusAway REST api's.
i got successful in getting all available bus routes but the problem here is I am not able to get bus routes if there is no direct route available for given starting and destination locations.
I am using these 4 api to get available bus schedules and map it accordingly. The problem here is if there is no direct route between starting and destination and user has to take another bus in route,it is not returning any data.
This new API i am working on is similar to PLAN TRIP REST api that onebusaway retired long back. Please let me know if there is any way i can get connecting bus routes as well.
stops-for-location -
search for stops near a location, optionally by stop code
stops-for-route - get the set of stops and
paths of travel for a particular route
MyLogic
1)Get nearby starting stops and routes using starting latitude and longitude. -- stops-for-location
2)Get nearby destination stops and routes using starting latitude and longitude.--- stops-for-location
3)Get common routes between starting and destination locations by intersecting step1 and step 2 values.
5) get common starting and destination stops for each available common routes by intersecting from step 1 and step 2.
5) loop through each common routes from step 3 and for each route get schedule for starting stop ids and with trip id in that route.--
schedule-for-stop6) for each trip id i will get trip details and get schedule arrival time for a bus at particular stop id along with respective destination schedule for destination stop id in that route---
trip-details .7)using this logic i am able to map starting and destination routes.
My Logic fails if there is no direct connection between routes. Please let me know if there is any alternative way we can get details of nearest possible connecting bus routes.