Usage of segment directions with Routes endpoint?

137 views
Skip to first unread message

electrobunny

unread,
Oct 1, 2014, 10:18:54 AM10/1/14
to transl...@googlegroups.com
I've looked at the segment directions provided under the Routes endpoint... this field returns a string of "forward" or "backward" for each segment. I had assumed these directions some how gave an idea of whether the segment was on the inbound or outbound portion of the bus route. Unless I have made a coding error, that does not appear to be the case. For example, looking at only the forward segments reveals gaps.

I think I read a suggestion elsewhere that the segment directions merely gave the polyline encoding direction.

Can someone please clarify what value the segment directions bring to the table?

Thanks.

Stu Zhao

unread,
Oct 1, 2014, 10:46:25 AM10/1/14
to transl...@googlegroups.com
Hi,

The direction of segments means in which order the points on the segment are visited by the route. For example, if the segment is encoded as point A -> B -> C, and the route refers to the segment as "backward", it means on that part of the route the segment is visited in order C -> B -> A. It is not related to inbound / outbound.

Thank you,

--
Yanglei (Stu) Zhao
TransLoc, Inc.

--
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.

electrobunny

unread,
Oct 1, 2014, 10:59:17 AM10/1/14
to transl...@googlegroups.com
Hi and thanks for the quick reply.

Sorry if I am being dense, but how would a bus visualization or route drawing take advantage of knowing the segment encoding direction? Is this a technical requirement of some client-end frameworks or maybe related to drawing performance? Does this simplify the decoding of the polyline? I have not required this info but would like to know it's utility, especially I cam somehow improve the app.

Stu Zhao

unread,
Oct 3, 2014, 9:56:58 AM10/3/14
to transl...@googlegroups.com
Hi,

One thing about segments is that two routes may share the same segment, or even the same route can go through the same segment, twice in the opposite direction. The reason for the encoding direction is so that you can know which direction the route goes on that segment at that occurrence. So you can, for example, draw direction arrows on the segment to visualize this information. Otherwise, it is not necessary.

--
Yanglei (Stu) Zhao
TransLoc, Inc.

topapplabs gmail

unread,
Oct 3, 2014, 9:39:34 PM10/3/14
to transl...@googlegroups.com, transl...@googlegroups.com
sorry, still a little confused. Maybe i should look at the data more carefully. it sounds like you are saying the encoding direction is the direction the bus travels through that segment. how does a segment which has a bus route that goes both ways through the segment denote this? is the segment listed as both forward and backward?
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/X-Ehx6H4esY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to transloc-api...@googlegroups.com.

Stu Zhao

unread,
Oct 6, 2014, 10:57:19 AM10/6/14
to transl...@googlegroups.com
Correct.

--
Yanglei (Stu) Zhao
TransLoc, Inc.

Reply all
Reply to author
Forward
0 new messages