proposed addition to spec: TripDescriptor.direction_id

125 views
Skip to first unread message

Ethan Arutunian

unread,
Nov 18, 2013, 8:17:40 PM11/18/13
to gtfs-r...@googlegroups.com

Based on the discussion around Metro North's real-time feed, I would like to formally propose the addition of the "direction_id" field to the TripDescriptor definition:

Field Name: direction_id
Type: uint32? bool? (open to suggestions here)
Cardinality: optional
Description: The direction_id from the GTFS that this selector refers to.
The direction_id field contains a binary value that indicates the direction of travel for a trip. Use this field to distinguish between bi-directional trips with the same route_id. This field is not used in routing; it provides a way to separate trips by direction when publishing time tables.
  • 0 - travel in one direction (e.g. outbound travel)
  • 1 - travel in the opposite direction (e.g. inbound travel)

The proposed initial GTFS-realtime producer is Metro North Railroad (to be added to their real-time feed).
The proposed initial consumer is Roadify (to test the change).

This is an official request for comments on the proposed change.

Thanks for your consideration!

-ethan

tomc...@gmail.com

unread,
Nov 18, 2013, 8:37:22 PM11/18/13
to gtfs-r...@googlegroups.com
I agree. On the NYCT feed we added a number of extensions including direction, track ID, ATS A Train ID plus others.
Sent on the Sprint® Now Network from my BlackBerry®

From: Ethan Arutunian <et...@roadify.com>
Date: Mon, 18 Nov 2013 17:17:40 -0800
Subject: [GTFS-realtime] proposed addition to spec: TripDescriptor.direction_id

--
You received this message because you are subscribed to the Google Groups "GTFS-realtime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gtfs-realtim...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gtfs-realtime/528ABC34.7090702%40roadify.com.
For more options, visit https://groups.google.com/groups/opt_out.

Brian Ferris

unread,
Nov 19, 2013, 1:27:58 AM11/19/13
to gtfs-r...@googlegroups.com
I'd vote for uint32 (vs bool) just because it more closely matches the int-like semantics that I've seen in most GTFS libraries that parse direction_id in trips.txt.

I'd actually also like to propose a slightly different strategy for handling extensions to GTFS-realtime like this one.  Read on for the details, but tl;dr - let's go ahead and reserve field #6 in TripDescriptor for this new field (aka "optional uint32 direction_id = 6;").

I'll post a separate message to the group about extension proposals.

Brian




Dave Barker, MBTA

unread,
Nov 19, 2013, 10:33:28 AM11/19/13
to gtfs-r...@googlegroups.com
Agreed! When known this is a highly valuable piece of data. 
Regarding bool vs. uint32, I would tend towards bool, since direction_id is described as a "binary value" in the GTFS spec.

-Dave Barker, MBTA

Michael Smith

unread,
Nov 19, 2013, 2:50:14 PM11/19/13
to gtfs-r...@googlegroups.com
It is certainly desirable for there to be just two directions. But I have seen so many complicated configurations that I'm sure some, though a very small number, could need more.  Still, for consistency, I think it should indeed be limited to a Boolean. 

Mike
--
You received this message because you are subscribed to the Google Groups "GTFS-realtime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gtfs-realtim...@googlegroups.com.

Brian Ferris

unread,
Nov 19, 2013, 2:54:51 PM11/19/13
to gtfs-r...@googlegroups.com
I think if there is any chance we'd want GTFS trips.txt direction_id to allow more than two values at some point in the future (conceivable), then that's a good reason to make GTFS-realtime direction_id a uint32, not a bool.  If we pick bool now, it becomes extremely difficult to change the type in the future.  Plus, direction_id just doesn't feel like a bool to me, as it's almost always communicated as 0 or 1 in GTFS, not as "true" or "false".


Barker, David

unread,
Nov 19, 2013, 2:58:52 PM11/19/13
to gtfs-r...@googlegroups.com
Valid reasoning. I certainly wouldn't object to it being an integer. 

-Dave (via mobile device)

Dave Barker, Manager of Operations Technology

For more options, visit https://groups.google.com/groups/opt_out.

______________________________________________________________________
This email has been scanned by MessageLabs and contains no viruses or malware.

_______________________________________________________________________
This email/electronic message, including any attached files, is being sent by the MBTA. It is solely intended for the recipient(s) and may contain information that is proprietary, confidential, legally privileged, and/or exempt from disclosure pursuant to state and federal law. If you have received this message in error or are not the intended recipient(s), please notify the sender immediately by reply, and delete all copies of this email/electronic message and any attached files from your computer. If you are the intended recipient(s), you may use the information contained in this email/electronic message and any attached files only as authorized by the MBTA. Any unauthorized use, dissemination, or disclosure of this email/electronic message and/or its attached files is strictly prohibited.

Michael Smith

unread,
Nov 19, 2013, 3:17:06 PM11/19/13
to gtfs-r...@googlegroups.com
Given that I think consistency is a good thing, would it be possible to also revisit the GTFS spec to see if both GTFS-realtime and GTFS can both be integers without breaking existing applications?

Mike


Brian Ferris

unread,
Nov 19, 2013, 3:28:39 PM11/19/13
to gtfs-r...@googlegroups.com
At the end of the day, trips.txt direction_id is just text in a GTFS feed.  It's more of a question of how GTFS parsers choose to implement the field.  In the OneBusAway GTFS library and in Google's own GTFS parser, it's parsed as an int.  In the Python-based transitfeed library, it's parsed as a string value.  I'm not sure how other libraries handle it.


Brian Ferris

unread,
Nov 26, 2013, 12:17:07 PM11/26/13
to gtfs-r...@googlegroups.com
I wanted to bump this thread again.  It seems like the field type is still the main issue at this point.  Any chance we can come to some consensus?  I'll admit that I still prefer "uint32".  Is there anyone who feels strongly enough that this is the wrong choice that'd they'd oppose adoption?


Stefan de Konink

unread,
Nov 26, 2013, 12:55:19 PM11/26/13
to gtfs-r...@googlegroups.com
Considering the at least five options in NeTEx for this value, I'm totally
pro uint32.

Stefan

Brian Ferris

unread,
Jan 31, 2014, 5:14:07 AM1/31/14
to gtfs-r...@googlegroups.com
I wanted to revive this proposal.  Since no one objected strongly when I made the suggestion two months ago, I'd like to formalize this proposal:

Let's reserve field #6 in TripDescriptor for this new field:

// The direction_id from the GTFS feed trips.txt file, indicating the direction of travel for this trip.
optional uint32 direction_id = 6;

Assuming I hear no objections, I will probably go ahead and reserve the field, as well as adding support in the OBA GTFS-realtime library.

Thoughts?

Brian Ferris

unread,
Feb 10, 2014, 9:35:29 AM2/10/14
to gtfs-r...@googlegroups.com
Ok, as there are no objections raised, I'm going to reserve field 6 of the GTFS-realtime TripDescriptor message for the direction_id field as proposed.  Note that this does NOT mean that the proposal has officially been adopted to the spec. Rather it means that GTFS-realtime producers and consumers will be using the specified field for evaluating this proposal for official adoption in the spec.

Thanks,
Brian
Reply all
Reply to author
Forward
0 new messages