# Invalid GTFS Data

**URL:** <https://opendataforum.transport.nsw.gov.au/t/invalid-gtfs-data/1442>\
**Category:** Real-time Public Transport\
**Created:** [November 8, 2018, 7:35am UTC](https://opendataforum.transport.nsw.gov.au/t/invalid-gtfs-data/1442 "2018-11-08T07:35:48Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Webmaster](https://sea1.discourse-cdn.com/flex019/user_avatar/opendataforum.transport.nsw.gov.au/webmaster/32/228_2.png) [@Webmaster](https://opendataforum.transport.nsw.gov.au/u/Webmaster)\
**Post date:** [November 8, 2018, 7:35am UTC](https://opendataforum.transport.nsw.gov.au/t/invalid-gtfs-data/1442/1 "2018-11-08T07:35:48Z")

</div>

Hate to be a pain, but your GTFS files still publish logically inconsistent data.

You are using different agency\_ids for the same agency\_name.

It’s not possible to make software work when identifiers don’t correctly describe what they represent in the real world.

How can the same agency have more than one unique agency\_id?

Well, very simply, you just change the agency\_name a bit so it represents just a part of the complete agency.

For example,  
“2439”,“State Transit Sydney”,“[http://transportnsw.info](http://transportnsw.info)”,“Australia/Sydney”,“EN”,“131500”  
“2440”,“State Transit Sydney”,“[http://transportnsw.info](http://transportnsw.info)”,“Australia/Sydney”,“EN”,“131500”  
“2441”,“State Transit Sydney”,“[http://transportnsw.info](http://transportnsw.info)”,“Australia/Sydney”,“EN”,“131500”

Just adding a parenthetical would fix the problem. The data would become logically consistent and software designed for GTFS could be guaranteed to make sense.

Please come to your senses and start making sense.

😫

---

<div class="post-metadata">

**Author:** ![alejandro.felman](https://avatars.discourse-cdn.com/v4/letter/a/bbe5ce/32.png) [@alejandro.felman](https://opendataforum.transport.nsw.gov.au/u/alejandro.felman)\
**Post date:** [November 8, 2018, 11:24pm UTC](https://opendataforum.transport.nsw.gov.au/t/invalid-gtfs-data/1442/2 "2018-11-08T23:24:59Z")

</div>

Hi @Webmaster, the different agency IDs correspond to different bus service regions. You need to look at the Reference Tables dataset to see how each agency is defined in the GTFS feeds. Eg. 2439 = region 7, 2440 = region 8, etc.

> **[User account | TfNSW Open Data Hub and Developer Portal](https://opendata.transport.nsw.gov.au/dataset/reference-tables/resource/30b850b7-f439-4e30-8072-e07ef62a2a36)**
>
> Transport for NSW's Open Data Portal

This is outlined in the notes on the API explorer and also in our documentation page.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/nsw/original/1X/f33e54bf7097ba8aad1324ba05315aabc61217b5.png)

Thanks,  
Alex

---

<div class="post-metadata">

**Author:** ![Webmaster](https://sea1.discourse-cdn.com/flex019/user_avatar/opendataforum.transport.nsw.gov.au/webmaster/32/228_2.png) [@Webmaster](https://opendataforum.transport.nsw.gov.au/u/Webmaster)\
**Post date:** [November 9, 2018, 3:39am UTC](https://opendataforum.transport.nsw.gov.au/t/invalid-gtfs-data/1442/3 "2018-11-09T03:39:41Z")

</div>

Excuses.

In other words, coerce.

💣

Then if I happen to notice reversion to good behavior I can seek out and undo coercive behavior and keep things working. Maybe.

Perhaps reorienting has merit. Lets not loose sight of the forest through the trees.

🙃

Just some food for thought for the TODO list.

Thank you for the reply.

---

<div class="post-metadata">

**Author:** ![Webmaster](https://sea1.discourse-cdn.com/flex019/user_avatar/opendataforum.transport.nsw.gov.au/webmaster/32/228_2.png) [@Webmaster](https://opendataforum.transport.nsw.gov.au/u/Webmaster)\
**Post date:** [November 11, 2018, 5:59am UTC](https://opendataforum.transport.nsw.gov.au/t/invalid-gtfs-data/1442/4 "2018-11-11T05:59:51Z")

</div>

Note: “2439 = region 7, 2440 = region 8, etc.” or similar mappings does not appear in the Reference Tables dataset.

Is the suffix of SMBSC and OSMBSC the region so that the following is correct?

‘2439’ =\> ‘State Transit Sydney (Region 7)’,  
‘2440’ =\> ‘State Transit Sydney (Region 8)’,  
‘2441’ =\> ‘State Transit Sydney (Region 9)’,

Does this hold for the other duplicate agency\_names?

---

<div class="post-metadata">

**Author:** ![alejandro.felman](https://avatars.discourse-cdn.com/v4/letter/a/bbe5ce/32.png) [@alejandro.felman](https://opendataforum.transport.nsw.gov.au/u/alejandro.felman)\
**Post date:** [November 13, 2018, 5:13am UTC](https://opendataforum.transport.nsw.gov.au/t/invalid-gtfs-data/1442/5 "2018-11-13T05:13:54Z")

</div>

Hi @Webmaster, the ‘Overlapping agencies in GTFS feeds’ dataset shows this.

SMBSC = “Sydney Metropolitan Bus Service Contracts”  
OSMBSC = “Outer Sydney Metropolitan Bus Service Contracts”

Like you said, each number after those corresponds to a region.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/nsw/original/1X/837ea03892bbdc59edf72b8ae91b5ff9bbd7ba91.png)

Same thing for all the duplicate agency names, there might be more than one region per agency.

Thanks,  
Alex

---

<div class="post-metadata">

**Author:** ![Webmaster](https://sea1.discourse-cdn.com/flex019/user_avatar/opendataforum.transport.nsw.gov.au/webmaster/32/228_2.png) [@Webmaster](https://opendataforum.transport.nsw.gov.au/u/Webmaster)\
**Post date:** [November 14, 2018, 5:16am UTC](https://opendataforum.transport.nsw.gov.au/t/invalid-gtfs-data/1442/6 "2018-11-14T05:16:31Z")

</div>

Are the region numbers familiar to the public or are they internal?

For example, would the public know what “Region 7” means in “State Transit Sydney (Region 7)”?

---

<div class="post-metadata">

**Author:** ![alejandro.felman](https://avatars.discourse-cdn.com/v4/letter/a/bbe5ce/32.png) [@alejandro.felman](https://opendataforum.transport.nsw.gov.au/u/alejandro.felman)\
**Post date:** [November 14, 2018, 6:15am UTC](https://opendataforum.transport.nsw.gov.au/t/invalid-gtfs-data/1442/7 "2018-11-14T06:15:47Z")

</div>

Hi @Webmaster, yes this is all publicly available information.

> **[Bus operator maps](https://transportnsw.info/travel-info/ways-to-get-around/bus/bus-operator-maps)**
>
> Find maps for bus routes run by different operators across Sydney, Central Coast, Newcastle, Hunter, Blue Mountains, Lithgow, Illawarra, South Coast and Southern Highlands

You can even find this in Wikipedia:

> **[Sydney Metropolitan Bus Service Contracts](https://en.wikipedia.org/wiki/Sydney_Metropolitan_Bus_Service_Contracts)**
>
> The Sydney Metropolitan Bus Service Contracts are contracts issued by the Government of New South Wales to metropolitan bus operators in Sydney, Australia. Since 2005, the government has moved from individual contracts with operators to larger contract regions, leading to the consolidation of bus operators.
> In February 2004 the Unsworth Review of Bus Services conducted by former Transport Minister and Premier Barrie Unsworth, reported its findings to the Carr Government, recommending that the n...

Thanks,  
Alex

---

<div class="post-metadata">

**Author:** ![Webmaster](https://sea1.discourse-cdn.com/flex019/user_avatar/opendataforum.transport.nsw.gov.au/webmaster/32/228_2.png) [@Webmaster](https://opendataforum.transport.nsw.gov.au/u/Webmaster)\
**Post date:** [November 17, 2018, 3:21pm UTC](https://opendataforum.transport.nsw.gov.au/t/invalid-gtfs-data/1442/8 "2018-11-17T15:21:23Z")

</div>

Hello again,

Can you say what the differences among the duplicates in the non-realtime GTFS bundle represent in the real world?

The region pattern doesn’t seem to be holding.

For example:

Premier Motor Service, agency\_id B025  
Premier Motor Service, agency\_id B083

Forest Coach Lines (No Real-Time), agency\_id B052  
Forest Coach Lines (No Real-Time), agency\_id B057  
Forest Coach Lines (No Real-Time) , agency\_id B005

train replacement bus operators, agency\_id 700  
train replacement bus operators, agency\_id 701

Sapphire Coast Buslines, agency\_id B034  
Sapphire Coast Buslines, agency\_id B033

Are there distinctions familiar to the public present in the agency\_ids?

🤔

---

<div class="post-metadata">

**Author:** ![jayen](https://sea1.discourse-cdn.com/flex019/user_avatar/opendataforum.transport.nsw.gov.au/jayen/32/208_2.png) [@jayen](https://opendataforum.transport.nsw.gov.au/u/jayen)\
**Post date:** [November 19, 2018, 4:03am UTC](https://opendataforum.transport.nsw.gov.au/t/invalid-gtfs-data/1442/9 "2018-11-19T04:03:07Z")

</div>

I would request that the agency\_id and agency\_name fields stay as is.

The agency name is displayed to end users, and they don’t care what region number a route is in. If you want to merge multiple regions using the same operator into one agency, that’s ok with me as a developer, but that sounds like a waste of my tax dollars…

From the spec:

| Field Name | Required | Details |
| --- | --- | --- |
| agency\_id | Optional | The agency\_id field is an ID that uniquely identifies a transit agency. A transit feed may represent data from more than one agency. The agency\_id is dataset unique. This field is optional for transit feeds that only contain data for a single agency. |
| agency\_name | Required | The agency\_name field contains the full name of the transit agency. Google Maps will display this name. |
