English | Site Directory

Google Transit Feed Specification

     

Google Transit Feed Specification

Revised February 29, 2008

The transit trip planning feature in Google Maps enables users to create efficient travel itineraries using public transportation schedules. This document explains how you can provide public transportation schedules to Google so that those schedules can be incorporated into Google Maps and other Google applications that show geographic data. This document explains the types of files that comprise a transit feed and defines the fields used in all of those files.

Table of Contents

Submitting a Transit Feed to Google

If you're at a public agency that oversees public transportation for your city and would like your data to be included, these are the steps in submitting a transit feed to Google:

  1. The agency exports transit data as a zip file in the Google Transit Feed Spec (GTFS) format and hosts the transit data zip files on a standard web server.
  2. The agency sends an e-mail to maps-transit-content@google.com with a link to the location of the transit data feed and the Google account IDs that should have access to the preview. To create a free Google account, click here: https://www.google.com/accounts/NewAccount.
  3. Google fetches the transit files from the agency's web server.
  4. Google builds a preview of the agency's data in Google Maps.
  5. The agency reviews the preview data and iterates with Google to resolve any issues.
  6. Google and the agency agree to go live with the transit data, and decide how often Google will check the transit agency's web server for feed updates.
  7. Transit data from the agency goes live on google.com.
  8. Google fetches new files from the agency's web server on a regular basis, and updates Google Maps and other geographic applications at Google with the latest feed.

Term Definitions

This section defines terms that are used throughout this document.

  • Field required - The field column must be included in your feed, and a value must be provided for each record. Some required fields permit an empty string as a value. To enter an empty string, just omit any text between the commas for that field. Note that 0 is interpreted as "a string of value 0", and is not an empty string. Please see the field definition for details.
  • Field optional - The field column may be omitted from your feed. If you choose to include an optional column, each record in your feed must have a value for that column. You may include an empty string as a value for records that do not have values for the column. Some optional fields permit an empty string as a value. To enter an empty string, just omit any text between the commas for that field. Note that 0 is interpreted as "a string of value 0", and is not an empty string.
  • Dataset unique - The field contains a value that maps to a single distinct entity within the column. For example, if a route is assigned the ID 1A, then no other route may use that route ID. However, you may assign the ID 1A to a location because locations are a different type of entity than routes.

Requirements

Google accepts transit feeds that contain the following files:

  • agency.txt - Required. This file contains information about one or more transit agencies that provide the data in this feed.
  • stops.txt - Required. This file contains information about individual locations where vehicles pick up or drop off passengers.
  • routes.txt - Required. This file contains information about a transit organization's routes. A route is a sequence of two or more stops.
  • trips.txt - Required. This file contains information about scheduled service along a particular route. Trips consist of two or more stops that are made at regularly scheduled intervals.
  • stop_times.txt - Required. This file lists the times that a vehicle arrives at and departs from individual stops for each trip along a route.
  • calendar.txt - Required . This file defines service categories. Each category indicates the days that service starts and ends as well as the days that service is available.
  • calendar_dates.txt - Optional. This file lists exceptions for the service categories defined in the calendar.txt file. If calendar_dates.txt includes ALL dates of service, this file may be specified instead of calendar.txt.
  • fare_attributes.txt - Optional. This file defines fare information for a transit organization's routes.
  • fare_rules.txt - Optional. This file defines the rules for applying fare information for a transit organization's routes.
  • shapes.txt - Optional. This file defines the rules for drawing lines on a map to represent a transit organization's routes.
  • frequencies.txt - Optional. This file defines the headway (time between trips) for routes with variable frequency of service.

File Requirements

The following requirements apply to the format and contents of your files:

  • All files in a Google Transit Feed Spec (GTFS) feed must be saved as comma-delimited text.
  • The first line of your feeds must contain field names. Each subsection of the Field Definitions section corresponds to one of the files in a transit feed and lists the field names you may use in that file.
  • All field names are case-sensitive.
  • Field values may not contain tabs, carriage returns or new lines.
  • Field values that contain quotation marks or commas must be enclosed within quotation marks. In addition, each quotation mark in the field value must be preceded with a quotation mark. This is consistent with the manner in which Microsoft Excel outputs comma-delimited (CSV) files. The following example demonstrates how a field value would appear in a comma-delimited file:
    • Original field value: Contains "quotes", commas and text
    • Field value in CSV file: "Contains ""quotes"", commas and text"
  • Field values should not contain HTML tags, comments or escape sequences.
  • Files should be encoded in UTF-8 to support all Unicode characters.
  • Name your feed files using the following naming conventions:
    • agency.txt
    • stops.txt
    • routes.txt
    • trips.txt
    • stop_times.txt
    • calendar.txt
    • calendar_dates.txt
    • fare_rules.txt
    • fare_attributes.txt
    • shapes.txt
    • frequencies.txt
  • Zip the files in your feed. Name the zip file google_transit.zip. Post the zip file in a directory named YYYYMMDD, where YYYYMMDD is the earliest date of valid service included in any of the files.

Updating Your Feeds

These guidelines apply to feed updates:

  • You may simultaneously post more than one zip file if each zip file contains all of the data for a unique date range. In other words, different zip files cannot contain data for overlapping service dates.

    Note: As described in the previous section, each zip file that you post should reside in a different directory on your server.

  • When Google fetches a new file, the data in that file will overwrite all data previously stored for your agency. As a result, please ensure that your files provide complete data for a service date range. As noted in the previous section, you can provide multiple zip files as long as the files do not contain data for overlapping service dates.

Requirements for Posting Your Feeds to Google Maps

These requirements apply to the location of your feeds:

  • You will need to provide the URL location of your feed. Google Maps can download feeds using either HTTP or HTTPS. You will also need to provide a login and password if they are needed to retrieve your feed.
  • Your IT/Networking teams should know that Google Maps periodically fetches transit feed data from the location that you specify, so that they do not change file permissions for your feed or otherwise block or break the data fetching process.

Field Definitions

agency.txt

Field Name 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.

agency_url

Required. The agency_url field contains the URL of the transit agency. The value must be a fully qualified URL that includes http:// or https://, and any special characters in the URL must be correctly escaped. See http://www.w3.org/Addressing/URL/4_URI_Recommentations.html for a description of how to create fully qualified URL values.

agency_timezone

Required. The agency_timezone field contains the timezone where the transit agency is located. Please refer to http://en.wikipedia.org/wiki/List_of_tz_zones for a list of valid values.

agency_lang

Optional. The agency_lang field contains a two-letter ISO 639-1 code for the primary language used by this transit agency. This setting defines capitalization rules and other language-specific settings for all text contained in this transit agency's feed. Please refer to http://www.loc.gov/standards/iso639-2/php/code_list.php for a list of valid values.

stops.txt

Field Name Details
stop_id

Required. The stop_id field contains an ID that uniquely identifies a stop. Multiple routes may use the same stop. The stop_id is dataset unique.

stop_code

Optional. The stop_code field contains short text or a number that uniquely identifies the stop for passengers. Stop codes are often used in phone-based transit information systems or printed on stop signage to make it easier for riders to get a stop schedule or real-time arrival information for a particular stop.

The stop_code field should only be used for stop codes that are displayed to passengers. For internal codes, use stop_id. This field should be left blank for stops without a code.

stop_name

Required. The stop_name field contains the name of a stop. Please use a name that people will understand in the local and tourist vernacular.

stop_desc

Optional. The stop_desc field contains a description of a stop. Please provide useful, quality information. Do not simply duplicate the name of the stop.

stop_lat

Required. The stop_lat field contains the latitude of a stop. The field value must be a valid WGS 84 latitude.

stop_lon

Required. The stop_lon field contains the longitude of a stop. The field value must be a valid WGS 84 longitude value from -180 to 180.

zone_id

Optional. The zone_id field defines the fare zone for a stop. Zone IDs are required if you want to provide fare information using fare_rules.txt.

stop_url

Optional. The stop_url field contains the URL of a web page about a particular stop. This should be different from the agency_url and the route_url fields.

The value must be a fully qualified URL that includes http:// or https://, and any special characters in the URL must be correctly escaped. See http://www.w3.org/Addressing/URL/4_URI_Recommentations.html for a description of how to create fully qualified URL values.

routes.txt

Field Name Details
route_id

Required. The route_id field contains an ID that uniquely identifies a route. The route_id is dataset unique.

agency_id

Optional. The agency_id field defines an agency for the specified route. This value is referenced from the agency.txt file. Use this field when you are providing data for routes from more than one agency.

route_short_name

Required. The route_short_name contains the short name of a route. This will often be a short, abstract identifier like "32", "100X", or "Green" that riders use to identify a route, but which doesn't give any indication of what places the route serves. If the route does not have a short name, please specify a route_long_name and use an empty string as the value for this field.

See a Google Maps screenshot highlighting the route_short_name.

route_long_name

Required. The route_long_name contains the full name of a route. This name is generally more descriptive than the route_short_name and will often include the route's destination or stop. If the route does not have a long name, please specify a route_short_name and use an empty string as the value for this field.

See a Google Maps screenshot highlighting the route_long_name.

route_desc

Optional. The route_desc field contains a description of a route. Please provide useful, quality information. Do not simply duplicate the name of the route. For example, "A trains operate between Inwood-207 St, Manhattan and Far Rockaway-Mott Avenue, Queens at all times. Also from about 6AM until about midnight, additional A trains operate between Inwood-207 St and Lefferts Boulevard (trains typically alternate between Lefferts Blvd and Far Rockaway)."

route_type

Required. The route_type field describes the type of transportation used on a route. Valid values for this field are:

  • 0 - Tram, Streetcar, Light rail. Any light rail or street level system within a metropolitan area.
  • 1 - Subway, Metro. Any underground rail system within a metropolitan area.
  • 2 - Rail. Used for intercity or long-distance travel.
  • 3 - Bus. Used for short- and long-distance bus routes.
  • 4 - Ferry. Used for short- and long-distance boat service.
  • 5 - Cable car. Used for street-level cable cars where the cable runs beneath the car.
  • 6 - Gondola, Suspended cable car. Typically used for aerial cable cars where the car is suspended from the cable.
  • 7 - Funicular. Any rail system designed for steep inclines.

See a Google Maps screenshot highlighting the route_type.

route_url

Optional. The route_url field contains the URL of a web page about that particular route. This should be different from the agency_url.

The value must be a fully qualified URL that includes http:// or https://, and any special characters in the URL must be correctly escaped. See http://www.w3.org/Addressing/URL/4_URI_Recommentations.html for a description of how to create fully qualified URL values.

route_color

Optional. In systems that have colors assigned to routes, the route_color field defines a color that corresponds to a route. The color must be provided as a six-character hexadecimal number, for example, 00FFFF. If the route_color makes overlaid text difficult to read, specify a contrasting text color with the route_text_color field.

route_text_color

Optional. The route_text_color field can be used to specify a legible color to use for text drawn against a background of route_color. The color must be provided as a six-character hexadecimal number, for example, FFD700.

trips.txt

Field Name Details
route_id

Required. The route_id field contains an ID that uniquely identifies a route. This value is referenced from the routes.txt file.

service_id

Required. The service_id contains an ID that uniquely identifies a set of dates when service is available for one or more routes. This value is referenced from the calendar.txt or calendar_dates.txt file.

trip_id

Required. The trip_id field contains an ID that identifies a trip. The trip_id is dataset unique.

trip_headsign

Optional. The trip_headsign field contains the text that appears on a sign that identifies the trip's destination to passengers. Use this field to distinguish between different patterns of service in the same route. If the headsign changes during a trip, you can override the trip_headsign by specifying values for the the stop_headsign field in stop_times.txt

See a Google Maps screenshot highlighting the headsign.

direction_id

Optional. The direction_id field contains a binary value that indicates the direction of travel for a trip. Use this field to distinguish between bi-directional trips with the same route_id. This field is not used in routing; it provides a way to separate trips by direction when publishing time tables. You can specify names for each direction with the trip_headsign field.

  • 0 - travel in one direction (e.g. outbound travel)
  • 1 - travel in the opposite direction (e.g. inbound travel)

For example, you could use the trip_headsign and direction_id fields together to assign a name to travel in each direction on trip "1234", the trips.txt file would contain these rows for use in time tables:

trip_id, ... ,trip_headsign,direction_id
1234, ... , to Airport,0
1234, ... , to Downtown,1

block_id

Optional. The block_id field identifies the block to which the trip belongs. A block consists of two or more sequential trips made using the same vehicle, where a passenger can transfer from one trip to the next just by staying in the vehicle. The block_id must be referenced by two or more trips in trips.txt.

shape_id

Optional. The shape_id field contains an ID that defines a shape for the trip. This value is referenced from the shapes.txt file. The shapes.txt file allows you to define how a line should be drawn on the map to represent a trip.

stop_times.txt

Field Name Details
trip_id

Required. The trip_id field contains an ID that identifies a trip. This value is referenced from the trips.txt file.

arrival_time

Required. The arrival_time specifies the arrival time at a specific stop for a specific trip on a route. For times occurring after midnight, enter the time as a value greater than 24:00:00 in HH:MM:SS local time for the day on which the trip schedule begins. If you don't have separate times for arrival and departure at a stop, enter the same value for arrival_time and departure_time.

You must specify arrival times for the first and last stops in a trip. If this stop isn't a time point, use an empty string value for the arrival_time and departure_time fields. Stops without arrival times will be scheduled based on the nearest preceding timed stop. To ensure accurate routing, please provide arrival and departure times for all stops that are time points. Do not interpolate stops.

The following columns list stop times for a trip and the proper way to express those times in the arrival_time field:

Time arrival_time value
08:10:00 A.M. 08:10:00
01:05:00 P.M. 13:05:00
07:40:00 P.M. 19:40:00
01:55:00 A.M. 25:55:00

Note: Trips that span multiple dates will have stop times greater than 24:00:00. For example, if a trip begins at 10:30:00 p.m. and ends at 2:15:00 a.m. on the following day, the stop times would be 22:30:00 and 26:15:00. Entering those stop times as 22:30:00 and 02:15:00 would not produce the desired results.

departure_time

Required. The departure_time specifies the departure time from a specific stop for a specific trip on a route. For times occurring after midnight, enter the time as a value greater than 24:00:00 in HH:MM:SS local time for the day on which the trip schedule begins. If you don't have separate times for arrival and departure at a stop, enter the same value for arrival_time and departure_time.

You must specify departure times for the first and last stops in a trip. If this stop isn't a time point, use an empty string value for the arrival_time and departure_time fields. Stops without arrival times will be scheduled based on the nearest preceding timed stop. To ensure accurate routing, please provide arrival and departure times for all stops that are time points. Do not interpolate stops.
The following columns list stop times for a trip and the proper way to express those times in the departure_time field:

Time departure_time value
08:10:00 A.M. 08:10:00
01:05:00 P.M. 13:05:00
07:40:00 P.M. 19:40:00
01:55:00 A.M. 25:55:00

Note: Trips that span multiple dates will have stop times greater than 24:00:00. For example, if a trip begins at 10:30:00 p.m. and ends at 2:15:00 a.m. on the following day, the stop times would be 22:30:00 and 26:15:00. Entering those stop times as 22:30:00 and 02:15:00 would not produce the desired results.

stop_id

Required. The stop_id field contains an ID that uniquely identifies a stop. Multiple routes may use the same stop. This value is referenced from the stops.txt file.

Where possible, stop_id values should remain consistent between feed updates. In other words, stop A with stop_id 1 should have stop_id 1 in all subsequent data updates. If a stop is not a time point, enter blank values for arrival_time and departure_time.

stop_sequence

Required. The stop_sequence field identifies the order of the stops for a particular trip. The values for stop_sequence must be non-negative integers, and they must increase along the trip.

For example, the first stop on the trip could have a stop_sequence of 1, the second stop on the trip could have a stop_sequence of 23, the third stop could have a stop_sequence of 40, and so on.

stop_headsign

Optional. The stop_headsign field contains the text that appears on a sign that identifies the trip's destination to passengers. Use this field to override the default trip_headsign when the headsign changes between stops. If this headsign is associated with an entire trip, use trip_headsign instead.

See a Google Maps screenshot highlighting the headsign.

pickup_type

Optional. The pickup_type field indicates whether passengers are picked up at a stop as part of the normal schedule or whether a pickup at the stop is not available. This field also allows the transit agency to indicate that passengers must call the agency or notify the driver to arrange a pickup at a particular stop. Valid values for this field are:

  • 0 - Regularly scheduled pickup
  • 1 - No pickup available
  • 2 - Must phone agency to arrange pickup
  • 3 - Must coordinate with driver to arrange pickup

The default value for this field is 0.

drop_off_type

Optional. The drop_off_type field indicates whether passengers are dropped off at a stop as part of the normal schedule or whether a drop off at the stop is not available. This field also allows the transit agency to indicate that passengers must call the agency or notify the driver to arrange a drop off at a particular stop. Valid values for this field are:

  • 0 - Regularly scheduled drop off
  • 1 - No drop off available
  • 2 - Must phone agency to arrange drop off
  • 3 - Must coordinate with driver to arrange drop off

The default value for this field is 0.

shape_dist_traveled

Optional. When used in the stop_times.txt file, the shape_dist_traveled field positions a stop as a distance from the first shape point. The shape_dist_traveled field represents a real distance traveled along the route in units such as feet or kilometers. For example, if a bus travels a distance of 5.25 kilometers from the start of the shape to the stop, the shape_dist_traveled for the stop ID would be entered as "5.25". This information allows the trip planner to determine how much of the shape to draw when showing part of a trip on the map. The values used for shape_dist_traveled must increase along with stop_sequence: they cannot be used to show reverse travel along a route.

The units used for shape_dist_traveled in the stop_times.txt file must match the units that are used for this field in the shapes.txt file.


calendar.txt

Field Name Details
service_id

Required. The service_id contains an ID that uniquely identifies a set of dates when service is available for one or more routes. This value is dataset unique. It is referenced by the trips.txt file.

monday

Required. The monday field contains a binary value that indicates whether the service is valid for all Mondays.

  • A value of 1 indicates that service is available for all Mondays in the date range. (The date range is specified using the start_date and end_date fields.)
  • A value of 0 indicates that service is not available on Mondays in the date range.

Note: You may list exceptions for particular dates, such as holidays, in the calendar_dates.txt file.

tuesday

Required. The tuesday field contains a binary value that indicates whether the service is valid for all Tuesdays.

  • A value of 1 indicates that service is available for all Tuesdays in the date range. (The date range is specified using the start_date and end_date fields.)
  • A value of 0 indicates that service is not available on Tuesdays in the date range.

Note: You may list exceptions for particular dates, such as holidays, in the calendar_dates.txt file.

wednesday

Required. The wednesday field contains a binary value that indicates whether the service is valid for all Wednesdays.

  • A value of 1 indicates that service is available for all Wednesdays in the date range. (The date range is specified using the start_date and end_date fields.)
  • A value of 0 indicates that service is not available on Wednesdays in the date range.

Note: You may list exceptions for particular dates, such as holidays, in the calendar_dates.txt file.

thursday

Required. The thursday field contains a binary value that indicates whether the service is valid for all Thursdays.

  • A value of 1 indicates that service is available for all Thursdays in the date range. (The date range is specified using the start_date and end_date fields.)
  • A value of 0 indicates that service is not available on Thursdays in the date range.

Note: You may list exceptions for particular dates, such as holidays, in the calendar_dates.txt file.

friday

Required. The friday field contains a binary value that indicates whether the service is valid for all Fridays.

  • A value of 1 indicates that service is available for all Fridays in the date range. (The date range is specified using the start_date and end_date fields.)
  • A value of 0 indicates that service is not available on Fridays in the date range.

Note: You may list exceptions for particular dates, such as holidays, in the calendar_dates.txt file

saturday

Required. The saturday field contains a binary value that indicates whether the service is valid for all Saturdays.

  • A value of 1 indicates that service is available for all Saturdays in the date range. (The date range is specified using the start_date and end_date fields.)
  • A value of 0 indicates that service is not available on Saturdays in the date range.

Note: You may list exceptions for particular dates, such as holidays, in the calendar_dates.txt file.

sunday

Required. The sunday field contains a binary value that indicates whether the service is valid for all Sundays.

  • A value of 1 indicates that service is available for all Sundays in the date range. (The date range is specified using the start_date and end_date fields.)
  • A value of 0 indicates that service is not available on Sundays in the date range.

Note: You may list exceptions for particular dates, such as holidays, in the calendar_dates.txt file.

start_date

Required. The start_date field contains the start date for the service.

The start_date field's value should be in YYYYMMDD format.

end_date

Required. The end_date field contains the end date for the service. This date is included in the service interval.

The end_date field's value should be in YYYYMMDD format.

calendar_dates.txt

Field Name Details
service_id

Required. The service_id contains an ID that uniquely identifies a set of dates when a service exception is available for one or more routes. If the same service_id value appears in both files, the information in calendar_dates.txt modifies the service information specified in calendar.txt. This field is referenced by the trips.txt file.

date

Required. The date field specifies a particular date when service availability is different than the norm. You can use the exception_type field to indicate whether service is available on the specified date.

The date field's value should be in YYYYMMDD format.

exception_type

Required. The exception_type indicates whether service is available on the date specified in the date field.

  • A value of 1 indicates that service has been added for the specified date.
  • A value of 2 indicates that service has been removed for the specified date.

For example, suppose a route has one set of trips available on holidays and another set of trips available on all other days. You could have one service_id that corresponds to the regular service schedule and another service_id that corresponds to the holiday schedule. For a particular holiday, you would use the calendar_dates file to add the holiday to the holiday service_id and to remove the holiday from the regular service_id schedule.

fare_attributes.txt

Field Name Details
fare_id

Required. The fare_id field contains an ID that uniquely identifies a fare class. The fare_id is dataset unique.

price

Required. The price field contains the fare price, in the unit specified by currency_type.

currency_type

Required. The currency_type field defines the currency used to pay the fare. Please use the ISO 4217 alphabetical currency codes which can be found at the following URL: http://www.iso.org/iso/en/prods-services/popstds/currencycodeslist.html.

payment_method

Required. The payment_method field indicates when the fare must be paid. Valid values for this field are:

  • 0 - Fare is paid on board.
  • 1 - Fare must be paid before boarding.
transfers

Required. The transfers field specifies the number of transfers permitted on this fare. Valid values for this field are:

  • 0 - No transfers permitted on this fare.
  • 1 - Passenger may transfer once.
  • 2 - Passenger may transfer twice.
  • (empty) - If this field is empty, unlimited transfers are permitted.
transfer_duration

Optional. The transfer_duration field specifies the length of time in seconds before a transfer expires.

When used with a transfers value of 0, the transfer_duration field indicates how long a ticket is valid for a fare where no transfers are allowed. Unless you intend to use this field to indicate ticket validity, transfer_duration should be omitted or empty when transfers is set to 0.

fare_rules.txt - Field Definitions

Field Name Details
fare_id

Required. The fare_id field contains an ID that uniquely identifies a fare class. This value is referenced from the fare_attributes.txt file.

route_id

Optional. The route_id field associates the fare ID with a route. Route IDs are referenced from the routes.txt file. If you have several routes with the same fare attributes, create a row in fare_rules.txt for each route.

For example, if fare class "b" is valid on route "TSW" and "TSE", the fare_rules.txt file would contain these rows for the fare class:

b,TSW
b,TSE

origin_id

Optional. The origin_id field associates the fare ID with an origin zone ID. Zone IDs are referenced from the stops.txt file. If you have several origin IDs with the same fare attributes, create a row in fare_rules.txt for each origin ID.

For example, if fare class "b" is valid for all travel originating from either zone "2" or zone "8", the fare_rules.txt file would contain these rows for the fare class:

b, , 2
b, , 8

destination_id

Optional. The destination_id field associates the fare ID with a destination zone ID. Zone IDs are referenced from the stops.txt file. If you have several destination IDs with the same fare attributes, create a row in fare_rules.txt for each destination ID.

For example, you could use the origin_ID and destination_ID fields together to specify that fare class "b" is valid for travel between zones 3 and 4, and for travel between zones 3 and 5, the fare_rules.txt file would contain these rows for the fare class:

b, , 3,4
b, , 3,5

contains_id

Optional. The contains_id field associates the fare ID with all routes that pass through a specified location. The contains ID field is a zone ID, referenced from the stops.txt file.

For example, if fare class "c" is associated with all travel on the GRT route that passes through zone 6, the fare_rules.txt would contain this row:

c,GRT,,,6

shapes.txt

Field Name Details
shape_id

Required. The shape_id field contains an ID that uniquely identifies a shape.

shape_pt_lat

Required. The shape_pt_lat field associates a shape point's latitude with a shape ID. The field value must be a valid WGS 84 latitude. Each row in shapes.txt represents a shape point in your shape definition.

For example, if the shape "A_shp" has three points in its definition, the shapes.txt file might contain these rows to define the shape:

A_shp,37.61956,-122.48161,0
A_shp,37.64430,-122.41070,6
A_shp,37.65863,-122.30839,11

shape_pt_lon

Required. The shape_pt_lon field associates a shape point's longitude with a shape ID. The field value must be a valid WGS 84 longitude value from -180 to 180. Each row in shapes.txt represents a shape point in your shape definition.

For example, if the shape "A_shp" has three points in its definition, the shapes.txt file might contain these rows to define the shape:

A_shp,37.61956,-122.48161,0
A_shp,37.64430,-122.41070,6
A_shp,37.65863,-122.30839,11

shape_pt_sequence

Required. The shape_pt_sequence field associates the latitude and longitude of a shape point with its sequence order along the shape. The values for shape_pt_sequence must be non-negative integers, and they must increase along the trip.

For example, if the shape "A_shp" has three points in its definition, the shapes.txt file might contain these rows to define the shape:

A_shp,37.61956,-122.48161,0
A_shp,37.64430,-122.41070,6
A_shp,37.65863,-122.30839,11

shape_dist_traveled

Optional. When used in the shapes.txt file, the shape_dist_traveled field positions a shape point as a distance traveled along a shape from the first shape point. The shape_dist_traveled field represents a real distance traveled along the route in units such as feet or kilometers. This information allows the trip planner to determine how much of the shape to draw when showing part of a trip on the map. The values used for shape_dist_traveled must increase along with shape_pt_sequence: they cannot be used to show reverse travel along a route.

The units used for shape_dist_traveled in the shapes.txt file must match the units that are used for this field in the stop_times.txt file.

For example, if a bus travels along the three points defined above for A_shp, the additional shape_dist_traveled values (shown here in kilometers) would look like this:

A_shp,37.61956,-122.48161,0,0
A_shp,37.64430,-122.41070,6,6.8310
A_shp,37.65863,-122.30839,11,15.8765

frequencies.txt

Field Name Details
trip_id

Required. The trip_id contains an ID that identifies a trip on which the specified frequency of service applies. Trip IDs are referenced from the trips.txt file.

start_time

Required. The start_time field specifies the time at which service begins with the specified frequency. For times occurring after midnight, enter the time as a value greater than 24:00:00 in HH:MM:SS local time for the day on which the trip schedule begins. E.g. 25:35:00.

end_time

Required. The end_time field indicates the time at which service changes to a different frequency (or ceases). For times occurring after midnight, enter the time as a value greater than 24:00:00 in HH:MM:SS local time for the day on which the trip schedule begins. E.g. 25:35:00.

headway_secs

Required. The headway_secs field indicates the time between departures from the same stop (headway) for this trip type, during the time interval specified by start_time and end_time. The headway value must be entered in seconds.

Periods in which headways are defined (the rows in frequencies.txt) shouldn't overlap for the same trip, since it's hard to determine what should be inferred from two overlapping headways. However, a headway period may begin at the exact same time that another one ends, for instance:

A, 05:00:00, 07:00:00, 600
B, 07:00:00, 12:00:00, 1200

Sample Data

This section shows comma-delimited data samples for each file in a transit feed. The sample data files shown here aren't all related to each other.

agency.txt

agency_id, agency_name,agency_url,agency_timezone
FunBus,The Fun Bus,http://www.thefunbus.org,America/Los Angeles

stops.txt

stop_id,stop_name,stop_desc,stop_lat,stop_lon,stop_url
S1,Mission St. & Silver Ave.,The stop is located at the southwest corner of the intersection.,37.728631,-122.431282
S2,Mission St. & Cortland Ave.,The stop is located 20 feet south of Mission St.,37.74103,-122.422482
S3,Mission St. & 24th St.,The stop is located at the southwest corner of the intersection.,37.75223,-122.418581
S4,Mission St. & 21st St.,The stop is located at the northwest corner of the intersection.,37.75713,-122.418982
S5,Mission St. & 18th St.,The stop is located 25 feet west of 18th St.,37.761829,-122.419382
S6,Mission St. & 15th St.,The stop is located 10 feet north of Mission St.,37.766629,-122.419782

routes.txt

route_id,route_short_name,route_long_name,route_desc,route_type
A,17,Mission,"The ""A"" route travels from lower Mission to Downtown. The ""A"" route is available for service on weekdays and weekends, but weekend service has limited stops.",3

trips.txt

route_id,service_id,trip_id,trip_headsign,block_id
A,WE,AWE1,Downtown,1
A,WE,AWE2,Downtown,2

stop_times.txt

trip_id,arrival_time,departure_time,stop_id,stop_sequence,pickup_type,dropoff_type
AWE1,0:06:10,0:06:10,S1,1,0,0,0
AWE1,,,S2,2,0,1,3
AWE1,0:06:20,0:06:30,S3,3,0,0,0
AWE1,,,S5,4,0,0,0
AWE1,0:06:45,0:06:45,S6,5,0,0,0
AWD1,0:06:10,0:06:10,S1,1,0,0,0
AWD1,,,S2,2,0,0,0
AWD1,0:06:20,0:06:20,S3,3,0,0,0
AWD1,,,S4,4,0,0,0
AWD1,,,S5,5,0,0,0
AWD1,0:06:45,0:06:45,S6,6,0,0,0

calendar.txt

service_id,monday,tuesday,wednesday,thursday,friday,saturday,sunday,start_date,end_date
WE,0,0,0,0,0,1,1,20060701,20060731
WD,1,1,1,1,1,0,0,20060701,20060731

calendar_dates.txt

This example shows service exceptions for the Independence Day holiday in 2006. On Monday July 3, 2006, regular weekday service (service_id=WD) is interrupted (exception_type=2). Instead, weekend service (service_id=WE) runs on that date (exception_type=1). The same change applies on Tuesday July 4, as well.

service_id,date,exception_type
WD,20060703,2
WE,20060703,1
WD,20060704,2
WE,20060704,1

fare_attributes.txt

fare_id,price,currency_type,payment_method,transfers,transfer_duration
1,0.00,USD,0,0,0
2,0.50,USD,0,0,0
3,1.50,USD,0,0,0
4,2.00,USD,0,0,0
5,2.50,USD,0,0,0

fare_rules.txt

fare_id,route_id,origin_id,destination_id,contains_id
a,TSW,1,1,
a,TSE,1,1,
a,GRT,1,1,
a,GRJ,1,1,
a,SVJ,1,1,
a,JSV,1,1,
a,GRT,2,4,
a,GRJ,4,2,
b,GRT,3,3,
c,GRT,,,6

shapes.txt

shape_id,shape_pt_lat,shape_pt_lon,shape_pt_sequence,shape_dist_traveled
A_shp,37.61956,-122.48161,1,0
A_shp,37.64430,-122.41070,2,6.8310
A_shp,37.65863,-122.30839,3,15.8765

frequencies.txt

trip_id,start_time,end_time,headway_secs
AWE1,05:30:00,06:30:00,300
AWE1,06:30:00,20:30:00,180
AWE1,20:30:00,28:00:00,420

Demo Transit Agency Example

The "Demo Transit Agency" is a fictional transit agency that Google created to illustrate a complete transit feed. To see transit data from this fictional agency in Google Maps, click here.

To view the zip file for this example, download the file sample-feed.zip. You can also preview the feed contents for the Demo Transit Agency as an HTML file or an XLS file.

Displaying Transit Data to Maps Users

The following screenshots show sample user interfaces displaying transit data in Google Maps. Each screenshot highlights a different field from a transit feed.

Note: The Google Maps user interface for transit is subject to change at Google's discretion. As such, there is no guarantee that the data that you provide will be displayed exactly as shown in the screenshots below.

Figure 1: Highlighting the route's short name (20)

Illustration of short name in the Google Transit User Interface

Figure 2: Highlighting the route's long name (Burnside/Stark)

Illustration of long name in the Google Transit User Interface

Figure 3: Highlighting the Trip Headsign (Beaverton TC)

Illustration of headsign in the Google Transit User Interface

Figure 4: Highlighting the Route Type (with a bus icon)

Illustration of route type icons in the Google Transit User Interface