Handling GTFS Blocks Part 1: Introduction

Transit agencies will almost always use each bus/train/tram continuously for an entire service day (or for some portion of it). Because a single trip on a single route may only take 30 minutes or an hour, each vehicle will perform potentially many trips in one day.

In some cases, the vehicle will just go back and forth on the same route. In other cases, once it reaches a certain point it will change its number. Sometimes passengers won’t know the route has changed; other times they will need to disembark and the vehicle may wait 20 or 30 minutes before starting its next trip.

In any case, transit agencies can represent the subsequent trips a single vehicle takes using the block_id field in GTFS. For instance, let’s look at the following screenshots from TransitTimes Adelaide.

This screenshot represents a single vehicle servicing two trips, each of a separate route. The first route (171) finishes at the shown stop, where its headsign number becomes 174.

It’s important as a developer to make use of this information if it is available, since patrons may be confused if your trip planner tells them to change buses if they don’t need to. Unfortunately, not all transit agencies provide this information (such as Transperth), but when the information is available to use we make use of it in TransitTimes!

While this is only an introduction to GTFS blocks, we’ll be posting various articles about good ways to make use of this field based on our experiences with TransitTimes. This will includes strategies for validating blocks, and how to optimize the data for quicker search.

Comments are closed.