Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

OneBusAway route coordinates

22 views
Skip to first unread message

Drew Baden

unread,
Jul 15, 2024, 6:55:43 PM7/15/24
to onebusaway-developers
There seems to be many ways to get the list of stops along a route.   But if I were to use the coordinates for those stops to draw a poly line on a map, it doesn't show corners where the bus turns, it just connects a diagonal.  This makes sense since it's just connecting the dots.   I see in the OneBusAway developers site that there's a "shape" API method that returns the actual coordinates along the route, but you have to know the vehicle ID.   My question is therefore 2-fold:

1. Getting the vehicle ID is doable, but since all busses on a given route pretty much will go through the same coordinates, isn't there a way to get the coordinates of points along a route?  So an API method where you give it the route (and maybe direction) and it returns a list of coordinates?

2. Is there a good way to decode the google encoded points (as given by the "shape" method) into longitude/latitude pairs?

Thanks,
   Drew

Drew Baden

unread,
Jul 15, 2024, 7:32:00 PM7/15/24
to onebusaway-developers
One more question, sorry.   When I use the API method 'trips-for-route', I can get a list of vehicleID's for each tripId.   The vehicleId has the form something like 1_4541.  But in the documentation for the method 'shape':


it uses a vehicleId of 1_10002005:

When I loop over vehicleId's from the 'trips-for-route' method, it returns no data and 'resource not found' in the 'text' field:

{
  "code" : 404,
  "text" : "resource not found",
  "version" : 2,
  "currentTime" : 1721086096893
}

So I guess I'm not understanding what 'shape' wants for the 'vehicleId'.   Any help?

Thanks again,
  Drew

Aaron Brethorst

unread,
Jul 16, 2024, 2:58:15 PM7/16/24
to onebusaway...@googlegroups.com
Hey Drew - I don’t specifically remember what I did to solve this problem in the iOS app (I think it’s been about 5 years since I last looked at that code!) but I recommend reading through the relevant code from the iOS codebase just to get a sense of how it handles this problem. https://github.com/OneBusAway/onebusaway-ios/blob/main/OBAKit/Trip/TripViewController.swift#L351

I think the vehicle ID in the docs is just an example and not a real ID.

-- 
You received this message because you are subscribed to the Google Groups "onebusaway-developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to onebusaway-devel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/onebusaway-developers/355e1a5d-66a4-437e-b393-dd4014423a65n%40googlegroups.com.

Drew Baden

unread,
Aug 9, 2024, 6:01:20 PM8/9/24
to onebusaway-developers
I found out that I could get the poly lines directly from the API via the stops-for-route method.  Sorry to bother anyone!

Drew

On Monday, July 15, 2024 at 3:55:43 PM UTC-7 Drew Baden wrote:
Reply all
Reply to author
Forward
0 new messages