Clarification on header record

4 views
Skip to first unread message

J. R. Westmoreland

unread,
Oct 1, 2009, 5:02:59 PM10/1/09
to gtfs-c...@googlegroups.com

I hope this is not out of line here.

 

When creating a feed,must the header record contain the name of all fields including optional ones?

I.E., in the agency file the agency_id, agency_lang and agency_phone fields is optional.

So, if you don’t have any of the optional fields would this record only contain agency_name, agency_url and agency_timezone? Therefore, all optional field names, where ever they appear, if not used, can be dropped from that record?

 

Just trying to make sure I understand what will happen when handling files like this.

 

Thanks,

J. R.

 

--------------------

J. R. Westmoreland

E-mail: j...@jrw.org

Twitter: GeneralJR

 

Joe Hughes

unread,
Oct 1, 2009, 5:17:00 PM10/1/09
to gtfs-c...@googlegroups.com
Hi J.R.,

The definition of "optional field" in the GTFS document is:

"Field optional - The field column may be omitted from your feed. If
you choose to include an optional column, each record in your feed
must have a value for that column...."

I admit that this doesn't answer your question as clearly as it could;
when it says the "column may be omitted", the intent is that you can
omit that header and the associated values for that header from the
file.

If you required the header to be present for optional fields, we'd
never be able to add new fields to the spec, since any new optional
field would "break" existing feeds that didn't include it.

Hope this helps,
Joe

Tom Hixson

unread,
Oct 1, 2009, 5:26:44 PM10/1/09
to Google Transit Feed Spec Changes
Also, the order of the fields does not matter.
> > Twitter: GeneralJR- Hide quoted text -
>
> - Show quoted text -

J. R. Westmoreland

unread,
Oct 1, 2009, 5:32:28 PM10/1/09
to gtfs-c...@googlegroups.com
I ask because I see it both ways.

It seems to me that if the field is optional and you don't use it at all in
your feed then you shouldn't put the field in the header. As opposed to
allowing you to put the field in the header and then leaving it blank all
the way through the file.
It just seems to me that this is a bit wishy-washy and could benefit from
being a bit more specific.
From a coding perspective, as it is now, you have to check for the existence
or the field in the header and then check to see if there is a value there
is it is in the header.

J. R.



--------------------
J. R. Westmoreland
E-mail: j...@jrw.org
Twitter: GeneralJR


Reply all
Reply to author
Forward
0 new messages