Headsign for loop service

I’m having trouble with the headsigns for some loop services, such as the 373 Coogee bus. trips.trip_headsign reads “Coogee Beach” and there is only one direction_id, presumably because it’s a loop.

Of course the actual bus headsign doesn’t read “Coogee Beach” as it heads to the city, it reads “Circular Quay” or something. What’s the best way to get an appropriate headsign for such situations?

@Bruceat Yes loops are always a tricky one.

As a TfNSW standard the loop service trip headsigns should be labelled:
Coogee via Museum

regardless of the direction travelled on the ground. Also we advise the Operator to only submit loop services in their data feeds in one direction (the inbound direction).

I can check what Transdev John Holland are currently doing and ask if they can amend their data files.

1 Like

Actually it looks like for loop services, the current destination should be defined in stop_times.stop_headsign.

To indicate the changing direction of travel, provide stop_headsigns in the stop_times.txt file. The stop_headsign describes the direction for trips departing from the stop for which it 's defined. Adding stop_headsigns to each stop of a trip allows you to change the headsign information along a trip.

However I’m not seeing this defined for anything but a handful of regional trains.

Hey @Bruceat , yes buses currently do not populate the stop_headsigns in the stop_times.txt file. All headsign information is in the trip.txt file.There is a reason for this :slight_smile: I can confirm.

In the meantime you could have a chat with @jxeeno who has also encountered similar issues for loops :slight_smile:

Thanks @Marcie.

Out of curiosity, could you say why the stop_headsigns are not populated? In the absence of this, is there any information available that can allow me to match the actual headsigns displayed on the bus?

To illustrate the problem I’m having, there are two bus stops across the road from each other, each serving the 375 in opposite directions. I want to be able to clearly tell people the direction of travel, but they both report Eastgardens, which would be very confusing for users.


Hi @Bruceat ,

Feedback from the team regarding loop services:

At the moment we only use the “stop_headsign” for Empty trains in the train feed.

We have looked at this before but we don’t have a source to populate this data with. We did look at populating with the name of the last stop on the trip but you still need a trigger for when the loop trip turns around and for that we don’t have the data either.

If you check out Anytrip @jxeeno has created his own solution.


Thanks for the response @Marcie.

@jxeeno if you can share any insight on how you’ve solved this, I’d appreciate it!

The only thing I can think to do is some kind of hack where I

  1. Look for “(Loop Service)” in the route_direction (e.g. Coogee to City Museum (Loop Service))
  2. If it exists, check whether the current stop_sequence is less than half the value of the final stop.
  3. If so, parse out “…to XXX (Loop Service)” where XXX is the destination for this stop.

Of course there are lots of problems with this. It relies on route_directions being named in a consistent way for loop services, and fails if a loop service doesn’t have the same number of stops in each direction. But it might be slightly better than what I have.

Any other suggestions would be very welcome!

Hey @Bruceat,

Based on feedback from users re loop services, AnyTrip is testing new logic for loop bus services so that headsigns are dynamic based on whether the service has passed its midpoint.

Before midpoint: Midpoint suburb then Final suburb (loop)
After midpoint: Final suburb via next timing point suburb
In final suburb: Final suburb

We’ve got a few different ways of determining midpoint. It’ll try to look for the suburb before the first non-consecutively repeated suburb that is around half-way through the stopping pattern. e.g. in the example A-A-A-B-B-C-C-B-B-B-A, C will be chosen because it’s the suburb before the first non-consecutively repeated suburb (B).

If it can’t find one that with that logic, it resorts to 50% along the stopping pattern.

Hope that helps!

Thanks @jxeeno, sounds like a nice approach. How are you determining the suburb? Is it available in one of the feeds? Or are you looking it up from the stop latitude and longitude?

Actually, now that I’m thinking of it, latitude and longitude could probably be used pretty effectively as well:

  • Calculate the distance between the first stop and each stop on the route.
  • Once the distance starts decreasing for more than a couple stops in a row, that is likely the midpoint.

Thanks again for your response.