Are the Route Segments Supposed to Be In Order?

73 views
Skip to first unread message

Bryan Farrell

unread,
Apr 7, 2016, 8:35:14 AM4/7/16
to TransLoc API
When I get a list of routes, it comes paired with a list of segments for that route, each paired with a "forward" or "backward" string. When I decode those segments, and flip the list of latitude/longitude points for the ones paired with "backward", I get some unexpected connections between each of the points. I looked into it further by placing each directed segment on a map separately, and they do not seem to be in the order of the actual direction of the route. Are they supposed to be in order? Does it have to do with how the routes were plotted? Or is that just how the API is, and you have to plot each segment by itself to get the correct-looking route?

Stu Zhao

unread,
Apr 7, 2016, 10:02:57 AM4/7/16
to TransLoc API
Bryan,

The segments are not supposed to be in order. You should plot each individual segment by itself. The reason is a single route at different times could deviate its shape, thus there is not really an good "order" for the segments.

Stu

On Thu, Apr 7, 2016 at 8:35 AM Bryan Farrell <bfar...@adelphi.edu> wrote:
When I get a list of routes, it comes paired with a list of segments for that route, each paired with a "forward" or "backward" string. When I decode those segments, and flip the list of latitude/longitude points for the ones paired with "backward", I get some unexpected connections between each of the points. I looked into it further by placing each directed segment on a map separately, and they do not seem to be in the order of the actual direction of the route. Are they supposed to be in order? Does it have to do with how the routes were plotted? Or is that just how the API is, and you have to plot each segment by itself to get the correct-looking route?

--
You received this message because you are subscribed to the Google Groups "TransLoc API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to transloc-api...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bryan Farrell

unread,
Apr 7, 2016, 10:10:29 AM4/7/16
to transl...@googlegroups.com
Hi Stu,

Ah, okay, so a route can change its shape? If it’s not too much trouble, just for my own information/understanding, would you be able to give me an example of why this would be the case? What would make a route change, while still maintaining the same segments?

Thanks,

Bryan

You received this message because you are subscribed to a topic in the Google Groups "TransLoc API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/transloc-api/j4DzQ0B25tE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to transloc-api...@googlegroups.com.

Stu Zhao

unread,
Apr 7, 2016, 10:26:20 AM4/7/16
to transl...@googlegroups.com
Bryan,

An example would be for peak hour, a route could have half of its buses skip some stops and going on highways. In this case, the API would return all segments to draw the route correctly, including the path for buses that make all stops, and for buses that skip stops.

The route segments returned by the API would differ from time to time based on what paths the buses could take around the time of the API call. In the morning it could return one shape, in the evening it could return another, all based on what the buses will do around the time of API call.

Thanks,

Stu

Bryan Farrell

unread,
Apr 7, 2016, 10:29:43 AM4/7/16
to transl...@googlegroups.com
Stu,

Okay, that makes sense. Thank you very much for the quick responses, and taking the time to explain it to me. I really appreciate it.

Thanks again,

Bryan
Reply all
Reply to author
Forward
0 new messages