# Trip\_id from Vehicle Position API is missing from GTFS

**URL:** <https://opendataforum.transport.nsw.gov.au/t/trip-id-from-vehicle-position-api-is-missing-from-gtfs/4767>\
**Category:** Real-time Public Transport\
**Created:** [December 10, 2024, 4:16am UTC](https://opendataforum.transport.nsw.gov.au/t/trip-id-from-vehicle-position-api-is-missing-from-gtfs/4767 "2024-12-10T04:16:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ethanhe3](https://avatars.discourse-cdn.com/v4/letter/e/2bfe46/32.png) [@ethanhe3](https://opendataforum.transport.nsw.gov.au/u/ethanhe3)\
**Post date:** [December 10, 2024, 4:16am UTC](https://opendataforum.transport.nsw.gov.au/t/trip-id-from-vehicle-position-api-is-missing-from-gtfs/4767/1 "2024-12-10T04:16:16Z")

</div>

Hi,

I am trying to figure out why some trip\_ids (excluding UNSCHEDULED or ADDED trips) returned in the Vehicle Position API do not correspond to any trip\_id within the trips.txt GTFS file. I have logged all instances where this is the case and was wondering what to do in these cases.

```auto
sydneytrains ==============================
SCHEDULED - NT31.1933.101.28.X.7.84251050
REPLACEMENT - NT36.1933.101.12.X.7.84250998
SCHEDULED - NT35.1933.101.12.X.7.84251062
SCHEDULED - NP24.1933.101.28.P.6.84246759
SCHEDULED - 1233.1933.101.4.W.0.84247772
SCHEDULED - HM13.1933.101.4.I.1.84247335
SCHEDULED - 1157.1933.101.28.W.0.84250362
CANCELED - 124M.1933.101.12.A.8.84249863
SCHEDULED - 149F.1933.101.4.A.8.84249810
REPLACEMENT - 191F.1933.101.4.B.8.84247898
SCHEDULED - KN51.1933.101.4.N.2.84246830
SCHEDULED - W315.1933.101.4.V.8.84268165
UNSCHEDULED - NonTimetabled.STND
SCHEDULED - 50AE.1933.101.4.M.4.84246483
SCHEDULED - HN60.1933.101.4.N.4.84247408
REPLACEMENT - 127J.1933.101.12.A.8.84247362
SCHEDULED - 37-J.1933.101.4.K.8.84249027
SCHEDULED - SN59.1933.101.4.N.4.84247694
SCHEDULED - SN49.1933.101.4.N.2.84246685
UNSCHEDULED - NonTimetabled.-4H-
UNSCHEDULED - NonTimetabled.N174
UNSCHEDULED - NonTimetabled.N168
UNSCHEDULED - NonTimetabled.N172
UNSCHEDULED - NonTimetabled.928-
SCHEDULED - 171Z.957.146.2.A.8.83150117
SCHEDULED - 182Z.957.146.2.A.8.83148056
SCHEDULED - 552T.957.146.2.A.8.83149204
SCHEDULED - 163Z.957.146.2.A.8.83151202
UNSCHEDULED - NonTimetabled.3964
UNSCHEDULED - NonTimetabled.215H
UNSCHEDULED - NonTimetabled.4T
SCHEDULED - 25-E.1933.101.28.B.8.84246163
UNSCHEDULED - NonTimetabled.MC--
SCHEDULED - 93-B.1933.101.28.A.8.84248259
SCHEDULED - 93-C.1933.101.28.A.8.84247858
SCHEDULED - 86-C.1933.101.28.A.8.84249841
SCHEDULED - 104D.1933.101.28.T.8.84249417
SCHEDULED - 104C.1933.101.28.T.8.84249418
SCHEDULED - 123L.1933.101.12.A.8.84247322
CANCELED - 124L.1933.101.12.A.8.84250982
UNSCHEDULED - NonTimetabled.452-
SCHEDULED - 2134.1933.101.12.W.0.84246724
SCHEDULED - CA14.1933.101.12.W.0.84247349
=================================================
nswtrains ==============================
SCHEDULED - 168.091224.127.1513
SCHEDULED - 172.091224.127.1500
SCHEDULED - 176.091224.127.1430
SCHEDULED - 371.091224.1.1415
SCHEDULED - 513.091224.127.1420
SCHEDULED - 522.091224.21.1423
SCHEDULED - 532.091224.85.1415
SCHEDULED - 540.091224.1.1235
SCHEDULED - 545.091224.1.1000
SCHEDULED - 589.091224.127.1415
REPLACEMENT - 719.091224.85.1445
SCHEDULED - 725.091224.127.1455
SCHEDULED - 727.091224.21.1415
SCHEDULED - 731.091224.127.1415
REPLACEMENT - 733.091224.85.1415
SCHEDULED - 755.091224.127.1440
SCHEDULED - 782.091224.127.1450
SCHEDULED - 791.091224.37.1450
SCHEDULED - NP23.1933.091224.28.P.6.84247189
REPLACEMENT - NP24.1933.091224.28.P.6.84246759
SCHEDULED - NP43.959.091224.124.P.2.83169709
SCHEDULED - NT32.1933.091224.28.X.7.84247140
SCHEDULED - NT33.1933.091224.28.X.7.84250847
SCHEDULED - NT35.1933.091224.12.X.7.84251062
SCHEDULED - NT36.1933.091224.12.X.7.84250998
=================================================
metro ==============================
ADDED - M1-I-CUD_DN-SYD_UP-1-20241209-035616:X
=================================================
lightrail/cbdandsoutheast ==============================
=================================================
lightrail/innerwest ==============================
=================================================
lightrail/newcastle ==============================
=================================================
ferries/sydneyferries ==============================
=================================================

```

Thanks

---

<div class="post-metadata">

**Author:** ![ethanhe3](https://avatars.discourse-cdn.com/v4/letter/e/2bfe46/32.png) [@ethanhe3](https://opendataforum.transport.nsw.gov.au/u/ethanhe3)\
**Post date:** [December 10, 2024, 6:54am UTC](https://opendataforum.transport.nsw.gov.au/t/trip-id-from-vehicle-position-api-is-missing-from-gtfs/4767/2 "2024-12-10T06:54:43Z")

</div>

Hi,

I realised that the trips were either RTTA\_DEF, RTTA\_REV, NonTimetabled, Out of Service or ADDED but I was still wondering how to handle ADDED trips as they do not have route information available.

---

<div class="post-metadata">

**Author:** ![snowbound\_balcony](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@snowbound\_balcony](https://opendataforum.transport.nsw.gov.au/u/snowbound_balcony)\
**Post date:** [January 7, 2025, 5:52am UTC](https://opendataforum.transport.nsw.gov.au/t/trip-id-from-vehicle-position-api-is-missing-from-gtfs/4767/3 "2025-01-07T05:52:37Z")

</div>

I’ve also been experiencing this issue over the last few days.

A few trips (from the realtime data today at `timestamp=1736136692`), e.g. `730Z.1431.117.2.A.8.84342699`, `730Y.1431.117.2.A.8.84342691`, are marked with `schedule_relationship=0/SCHEDULED` but yet the Sydney Trains GTFS data from `Sun, 05 Jan 2025 14:01:08 GMT` does not include them.

I also can see that these run numbers tend to have different trips with valid data, but that’s not particularly helpful since there can be a variety of trips for one run number.

---

<div class="post-metadata">

**Author:** ![Marcie](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Marcie](https://opendataforum.transport.nsw.gov.au/u/Marcie)\
**Post date:** [January 10, 2025, 3:52am UTC](https://opendataforum.transport.nsw.gov.au/t/trip-id-from-vehicle-position-api-is-missing-from-gtfs/4767/4 "2025-01-10T03:52:35Z")

</div>

Hi @ethanhe3 and @snowbound_balcony,

Thanks for your queries.

@ethanhe3 - as per [Sydney Trains Documentation](https://opendata.transport.nsw.gov.au/sites/default/files/2024-12/Real%20Time%20Train%20Technical%20Document%20v3_6_open%20data_0.pdf), ADDED trips should have a corresponding route\_id:

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

@snowbound_balcony do you have a screenshot of those trips? They could be non revenue trips.

---

<div class="post-metadata">

**Author:** ![snowbound\_balcony](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@snowbound\_balcony](https://opendataforum.transport.nsw.gov.au/u/snowbound_balcony)\
**Post date:** [January 10, 2025, 4:22am UTC](https://opendataforum.transport.nsw.gov.au/t/trip-id-from-vehicle-position-api-is-missing-from-gtfs/4767/5 "2025-01-10T04:22:15Z")

</div>

@Marcie Yes, they can be RRTA\_DEF/RTTA\_REV. But not exclusively:

```auto
DEBUG: __main__ :Could not find (scheduled) trip for trip_id: 610R.677.126.32.T.8.84624116 trip {
  trip_id: "610R.677.126.32.T.8.84624116"
  route_id: "ESI_2d"
}
stop_time_update {
  arrival {
    time: 1736434985
  }
  stop_id: "2230211"
}
stop_time_update {
  arrival {
    delay: 0
    time: 1736436600
  }
  stop_id: "2220362"
}
vehicle {
  [transit_realtime.tfnsw_vehicle_descriptor] {
    vehicle_model: "T"
  }
}
timestamp: 1736436504

```

or this one:

```auto
DEBUG: __main__ :Could not find (scheduled) trip for trip_id: 298H.677.126.56.H.8.83892129 trip {
  trip_id: "298H.677.126.56.H.8.83892129"
  route_id: "CCN_2b"
}
stop_time_update {
  arrival {
    time: 1736423701
  }
  departure {
    time: 1736425861
  }
  stop_id: "229354"
}
stop_time_update {
  arrival {
    time: 1736426010
  }
  departure {
    time: 1736426040
  }
  stop_id: "2303151"
}
stop_time_update {
  arrival {
    time: 1736426220
  }
  departure {
    time: 1736426250
  }
  stop_id: "229271"
}
stop_time_update {
  arrival {
    time: 1736426400
  }
  departure {
    time: 1736426430
  }
  stop_id: "2289331"
}
stop_time_update {
  arrival {
    time: 1736426550
  }
  departure {
    time: 1736426580
  }
  stop_id: "2289341"
}
stop_time_update {
  arrival {
    time: 1736426820
  }
  departure {
    time: 1736426850
  }
  stop_id: "2285361"
}
stop_time_update {
  arrival {
    time: 1736427066
  }
  departure {
    time: 1736427096
  }
  stop_id: "2284171"
}
stop_time_update {
  arrival {
    time: 1736427240
  }
  departure {
    time: 1736427270
  }
  stop_id: "2284181"
}
stop_time_update {
  arrival {
    time: 1736427360
  }
  departure {
    time: 1736427390
  }
  stop_id: "2284161"
}
stop_time_update {
  arrival {
    time: 1736427630
  }
  departure {
    time: 1736427660
  }
  stop_id: "2283231"
}
stop_time_update {
  arrival {
    time: 1736427900
  }
  departure {
    time: 1736427930
  }
  stop_id: "2283221"
}
stop_time_update {
  arrival {
    time: 1736428440
  }
  departure {
    time: 1736428470
  }
  stop_id: "2264191"
}
stop_time_update {
  arrival {
    time: 1736428710
  }
  departure {
    time: 1736428740
  }
  stop_id: "2264201"
}
stop_time_update {
  arrival {
    time: 1736429076
  }
  departure {
    time: 1736429106
  }
  stop_id: "2259931"
}
stop_time_update {
  arrival {
    time: 1736429460
  }
  departure {
    time: 1736429490
  }
  stop_id: "2259921"
}
stop_time_update {
  arrival {
    time: 1736429790
  }
  departure {
    time: 1736429820
  }
  stop_id: "2259942"
}
stop_time_update {
  arrival {
    time: 1736429970
  }
  departure {
    time: 1736430000
  }
  stop_id: "2259911"
}
stop_time_update {
  arrival {
    time: 1736430312
  }
  departure {
    time: 1736430342
  }
  stop_id: "2258111"
}
stop_time_update {
  arrival {
    time: 1736430492
  }
  departure {
    time: 1736430522
  }
  stop_id: "2250801"
}
stop_time_update {
  arrival {
    time: 1736430630
  }
  departure {
    time: 1736430660
  }
  stop_id: "2250821"
}
stop_time_update {
  arrival {
    time: 1736430762
  }
  departure {
    time: 1736430792
  }
  stop_id: "2250811"
}
stop_time_update {
  arrival {
    time: 1736431020
  }
  stop_id: "2250791"
}
vehicle {
  [transit_realtime.tfnsw_vehicle_descriptor] {
    vehicle_model: "H"
  }
}
timestamp: 1736431546

```

This is from the GTFS feeds which I redownloaded just then, and current realtime data.  
There’s also a fair amount which don’t have stop data at all, despite being scheduled/replacement trips (which is invalid per both the official GTFS spec and per the tfnsw modified one)

```auto
DEBUG: __main__ :Could not find (scheduled) trip for trip_id: 27-P.677.126.36.B.8.83895213 trip {
  trip_id: "27-P.677.126.36.B.8.83895213"
  schedule_relationship: SCHEDULED
  route_id: "IWL_1a"
}
vehicle {
  [transit_realtime.tfnsw_vehicle_descriptor] {
    vehicle_model: "B"
  }
}
timestamp: 1736432357

```

```auto
DEBUG: __main__ :Replacement trip with no stops, 45-F.677.129.64.K.8.83893624: trip {
  trip_id: "45-F.677.129.64.K.8.83893624"
  schedule_relationship: REPLACEMENT
  route_id: "RTTA_DEF"
}
vehicle {
  [transit_realtime.tfnsw_vehicle_descriptor] {
    vehicle_model: "K"
  }
}
timestamp: 1736465094

```

If it helps at all, I’ve attached what I’m seeing in the realtime feed, my debug output, and also the static GTFS feed (which is the current one from your website — sorry for the triple compression, but it needed it to fit under 8MB)  
[realtime-data-and-output.zip](https://opendataforum.transport.nsw.gov.au/uploads/short-url/fnGOb3ANvkXJosKNKNDX7KkXltO.zip) (91.8 KB)  
[data3.zip](https://opendataforum.transport.nsw.gov.au/uploads/short-url/oB49OOYG8PtoDrjrqw0NPKuKg59.zip) (7.7 MB)

---

<div class="post-metadata">

**Author:** ![Marcie](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Marcie](https://opendataforum.transport.nsw.gov.au/u/Marcie)\
**Post date:** [January 13, 2025, 12:07am UTC](https://opendataforum.transport.nsw.gov.au/t/trip-id-from-vehicle-position-api-is-missing-from-gtfs/4767/6 "2025-01-13T00:07:19Z")

</div>

Hi @snowbound_balcony, I’ve raised with Sydney trains. I’ll let you know what they come back with.

Thanks,  
Marcela
