# Block transfer example

> [!NOTE]
> **Note:** To make block transfer an available option, you need to use `block_id` in `trips.txt`. Google doesn't support the [linked trips](https://gtfs.org/schedule/reference/#linked-trips) feature through `transfer_type` values of `4` or `5`.

Block transfer, also called in-seat transfer, is available when a set of
trips meets the following conditions:

1. The trips are consecutive.
2. The same vehicle operates both trips.
3. The trips are provisioned with the same `block_id` value in the `trips.txt` file in the transit feed.

## Prerequisites

For Google Maps to recognize that block transfers between trips are
possible, the following prerequisites must be met:

1. The trips must use the same `block_id` value in `trips.txt`. This indicates that the trips use the same vehicle.
2. The trips must operate on the same days, or on consecutive days if a trip crosses midnight.
3. The trips must be consecutive and not overlap.
4. The last stop of the arriving trip and the first stop of the departing trip must either be the same (recommended) or physically close.

## Use `block_id` to enable block transfers

Block transfers can be made between consecutive trips on different routes or on
the same route if the route is a loop line. Use the `block_id` field to specify
which trips are in one block and where in-seat transfers are an available
option.

### Example 1: Block transfers for scheduled trips

In this example, consider the following values in each file:

`trips.txt`

| `route_id` | `trip_id` | `block_id` |
|---|---|---|
| `RouteA` | `RouteATrip1` | `Block1` |
| `RouteB` | `RouteBTrip1` | `Block1` |

<br />

*** ** * ** ***

`stop_times.txt`

| `trip_id` | `arrival_time` | `departure_time` | `stop_id` | `stop_sequence` |
|---|---|---|---|---|
| `RouteATrip1` | `12:00:00` | `12:01:00` | `A` | `1` |
| `RouteATrip1` | `12:05:00` | `12:06:00` | `B` | `2` |
| `RouteATrip1` | `12:15:00` |   | `C` | `3` |
| `RouteBTrip1` |   | `12:18:00` | `C` | `1` |
| `RouteBTrip1` | `12:22:00` | `12:23:00` | `D` | `2` |
| `RouteBTrip1` | `12:30:00` |   | `E` | `3` |

<br />

In this example:

- A user who searches for a route from stop A to stop E is directed to embark at stop A at 12:00 on Route A and to stay on the vehicle when it reaches stop C after the end of `RouteATrip1`. This is because the same vehicle services `RouteBTrip1` for Route B.
- Passengers on `RouteATrip1` who want to continue on to a stop on `RouteBTrip1` can stay on the vehicle for this transfer.
- Passengers of other trips on other vehicles along these same routes don't have this option because they use different vehicles for each trip.

### Example 2: Block transfers for frequency-based trips with exact times

Block transfers are supported only for frequency-based trips that meet one of
the following conditions, in addition to the requirements listed in the
[Prerequisites](https://developers.google.com/transit/gtfs/examples/block-transfer-example#prerequisites) section:

- If the trip is a loop, it must start and end at the same stop.
- In `frequencies.txt`, the value of the `exact_times` field must be `1`.

The following example describes how to set the values for the second condition:

`trips.txt`

| `route_id` | `trip_id` | `block_id` |
|---|---|---|
| `route1` | `route1_trip1` | `block_2` |
| `route2` | `route2_trip1` | `block_2` |

<br />

*** ** * ** ***

`stop_times.txt`

| `trip_id` | `arrival_time` | `departure_time` | `stop_id` | `stop_sequence` |
|---|---|---|---|---|
| `route1_trip1` | `08:00:00` | `08:04:00` | `stop1` | `1` |
| `route1_trip1` | `08:10:00` | `08:14:00` | `stop2` | `2` |
| `route1_trip1` | `08:20:00` |   | `stop3` | `3` |
| `route2_trip1` |   | `08:24:00` | `stop3` | `1` |
| `route2_trip1` | `08:30:00` | `08:34:00` | `stop4` | `2` |
| `route2_trip1` | `08:40:00` | `08:44:00` | `stop5` | `3` |

<br />

*** ** * ** ***

`frequencies.txt`

| `trip_id` | `start_time` | `end_time` | `headway_secs` | `exact_times` |
|---|---|---|---|---|
| `route1_trip1` | `08:00:00` | `08:20:00` | `600` | `1` |
| `route2_trip1` | `08:24:00` | `08:44:00` | `600` | `1` |

<br />

In this example:

- A user who searches for a route from `stop1` to `stop5` is directed to embark at `stop1` at 08:00 on `route1`. The user then stays on the vehicle when it reaches `stop3` after the end of `route1_trip1`. This is because the same vehicle services `route2_trip1` for `route2`.
- Passengers on `route1_trip1` who want to continue on to a stop on `route2_trip1` can stay on the vehicle for this transfer.
- Passengers of other trips on other vehicles along these same routes don't have this option because they use different vehicles for each trip.
- Take `route1_trip1` for example. The value of `headway_secs` is half the interval between `start_time` and `end_time`. In this case, it means there are two trips. To learn more about the usage of `headway_secs`, refer to the [GTFS Schedule Reference on
  gtfs.org](https://gtfs.org/schedule/reference/#frequenciestxt).

## Block transfer in a loop line

In a loop line, the first stop and the last stop of a trip are the same and have
the same `stop_id`. This is required for both schedule-based and frequency-based
trips.

Provided that consecutive loop trips have the same `block_id`, block or in-seat
transfer is enabled, which lets passengers of the first trip remain on the
vehicle when it continues on the next loop.

## Valid blocks in GTFS feeds

For block transfer to be possible, you must properly define one or more blocks
in the feed. To pass validation, trips that belong to the same block can't
overlap and must have the same `route_type` (subway, rail, bus, and so forth).
Trips can belong to the same block even if they're on different days. If any
blocks are defined in a static feed, they show in the Validation Report, on the
**Overview** tab.

> [!NOTE]
> **Note:** The feed validator only checks the integrity of the feed. It doesn't check for any of the other conditions that make block transfer possible.