Transport Department

Public transport headway data specification

官方 PDF

PDF page 1

Data Specification of Headway Information of Public Transport Services in General Transit Feed Specification format (27 October 2020)


Introduction
General Transit Feed Specification (GTFS), as known as GTFS static or static transit, defines a common format for public transportation schedules and associated geographic information.

Summary of Headway Information of Public Transport Services Entities
 No. Filename             Entity in ER Diagram      Description                                                                                               Remarks
 1     agency.txt               public.agency               One or more transit agencies that operate routes in this feed.                                    Agencies of any joint-operating
                                                                                                                                                              route is defined as an individual
                                                                                                                                                              agency
 2     stops.txt                public.stops                Individual locations where vehicles pick up or drop off passengers.
 3     routes.txt               public.routes               Transit routes. A route is a group of trips that are displayed to riders as a single service.
 4     trips.txt                public.trips                Trips for each route. A trip is a sequence of two or more stops that occurs at specific time.     For routes having unified
                                                                                                                                                              headway, only one trip is
                                                                                                                                                              defined in trips.txt.
                                                                                                                                                              For routes having alternative
                                                                                                                                                              headway, trips are broken down.
 5     stop_times.txt           public.stop_times           Times that a vehicle departs from origin and arrives at destination for each trip.
 6     calendar.txt             public.calendar             Dates for service IDs using a weekly schedule. Specify when service starts and ends, as well
                                                            as days of the week where service is available.
 7     calendar_dates.txt       public.calendar_dates       Exceptions for the service IDs defined in the calendar.txt file.
 8     frequencies.txt          public.frequencies          Headway (time between trips) that supplements trips of a route                                    For routes having unified
                                                                                                                                                              headway, trip should be read
                                                            This table is intended to represent schedules that do not have a fixed list of stop times. When
                                                                                                                                                              together with corresponding
                                                            trips are defined in frequencies.txt, the absolute values of the arrival_time and
                                                                                                                                                              record in frequencies.txt
                                                            departure_time fields in stop_times.txt should be ignored.
 9     fare_attributes.txt      public.fare_attributes      Fare information for transit organization's routes
 10    fare_rules.txt           public.fare_rules           Rules for applying fare information for transit organization's routes.

      Note:
           This specification is developed based on GTFS developed by Google Inc. For more information, see https://developers.google.com/transit/gtfs/reference
           All files in a General Transit Feed Spec (GTFS) feed are saved as comma-delimited text.
           The first line of each file contains field names, and all field names are case-sensitive.
           All field values are enclosed within quotation marks being consistent with the manner in which Microsoft Excel outputs comma-delimited (CSV) files. For more information on
            the CSV file format, see http://tools.ietf.org/html/rfc4180.
           Each record is ended with a CRLF or LF linebreak character.
           Files are encoded in UTF-8 to support all Unicode characters.

                                                                                       Page 1 of 13

PDF page 2

Data Definition of GTFS Entities
1. AGENCY
        File: AGENCY.TXT

 ITEM NAME                    DESCRIPTION                                                                                  WIDTH   TYPE
 agency_id                    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. It can be
                              correlated with company_code in <Routes and fares of public transport> dataset
                              disseminated via Data.gov.hk.                                                                 10       Text
 agency_name                  The agency_name field contains the full name of the transit agency. Operator names are
                              listed for Franchised Bus services, Tram services, Peak Tram services, MTR Bus services,
                              Park Island Residents’ services and Discovery Bay Residents’ services. Mode names are
                              listed for GMB services, Ferry services and Cross-boundary Coach services.                    100      Text
 agency_url                   The agency_url field contains the URL of the transit agency.                                  255      Text
 agency_timezone              The agency_timezone field contains the timezone where the transit agency is located.           10      Text
 agency_lang                  The agency_lang field contains a IETF BCP 47 language code specifying the primary
                              language used by this transit agency.                                                         10       Text




                                                                                    Page 2 of 13

PDF page 3

2.   STOPS
         File: STOPS.TXT

 ITEM NAME                  DESCRIPTION                                                                                         WIDTH   TYPE
 stop_id                    The stop_id field contains an ID that uniquely identifies a stop, station, or station entrance.
                            Multiple routes may use the same stop. The stop_id is dataset unique. It can be correlated
                            with stop_id in <Routes and fares of public transport> dataset disseminated via
                            Data.gov.hk.                                                                                                 Number
 stop_name                  The stop_name field contains the name of a stop, station, or station entrance. Stop names
                            of joint operating routes, individually defined by involved operators, are shown and
                            delimited by “/”. For stops involving multiple agencies, stop names of involved agencies
                            are shown and delimited by “|”                                                                       100      Text
 stop_lat                   The stop_lat field contains the latitude of a stop, station, or station entrance. The field value
                            must be a valid WGS 84 latitude.                                                                             Number
 stop_lon                   The stop_lon field contains the longitude of a stop, station, or station entrance. The field
                            value must be a valid WGS 84 longitude value from -180 to 180.                                               Number
 zone_id                    The zone_id field defines the fare zone for a stop ID.                                                       Number
 location_type              The location_type field identifies whether this stop ID represents a stop, station, or station
                            entrance. The location type field is coded as stop (i.e. “0”)                                                Number
 stop_timezone              The stop_timezone field contains the timezone in which stop is located.                              10       Text




                                                                                      Page 3 of 13

PDF page 4

3.   ROUTES
         File: ROUTES.TXT

 ITEM NAME             DESCRIPTION                                                                                     WIDTH   TYPE
 route_id              The route_id field contains an ID that uniquely identifies a route. The route_id is dataset
                       unique. It can be correlated with route_id in <Routes and fares of public transport> dataset
                       disseminated via Data.gov.hk.                                                                            Number
 agency_id             The agency_id field defines an agency for the specified route. This value is referenced from
                       the agency.txt file.                                                                             10       Text
 route_short_name      The route_short_name contains the short name of a route. This will often be a short, abstract
                       identifier that travelers use to identify a route.                                               20       Text
 route_long_name       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 origin and
                       destination.                                                                                     100      Text
 route_type            The route_type field describes the type of transportation used on a route. Valid values for
                       this field are:
                       * 0 – Tram Services
                       * 3 – Bus Services and Green Minibus Services
                       * 4 – Ferry Services
                       * 7 - Peak Tram Services                                                                                 Number
 route_url             The route_url field contains the URL of a web page about the route.
                                                                                                                        255      Text




                                                                                Page 4 of 13

PDF page 5

4.   TRIPS
         File: TRIPS.TXT

 ITEM NAME                  DESCRIPTION                                                                                    WIDTH   TYPE
 route_id                   The route_id field contains an ID that uniquely identifies a route. This value is referenced
                            from the routes.txt file.                                                                              Number
 service_id                 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.                                                           Number
 trip_id                    The trip_id field contains an ID that identifies a trip. The trip_id is dataset unique. The
                            trip_id is composed of: (1) route id; (2) route bound; (3) service id; (4) departure time.
                            Route id and route bound can be correlated in pair with route id and route_seq in <Routes
                            and fares of public transport> dataset disseminated via Data.gov.hk.                           20      Text




                                                                                    Page 5 of 13

PDF page 6

5.   STOP_TIMES
         File: STOP_TIMES.TXT

 ITEM NAME               DESCRIPTION                                                                                     WIDTH   TYPE
                         The trip_id field contains an ID that identifies a trip. This value is referenced from the
 trip_id                 trips.txt file.                                                                                  20       Text
                         The arrival_time specifies the estimated arrival time at a specific stop for a specific trip
                         on a route. The time is measured from "noon minus 12h" (effectively midnight, except
                         for days on which daylight savings time changes occur) at the beginning of the service
                         day. For times occurring after midnight on the service day, the time is a value greater
 arrival_time            than 24:00:00 in HH:MM:SS local time for the day on which the trip schedule begins.              10       Text
                         The departure_time specifies the designated departure time from a specific stop for a
                         specific trip on a route. The time is measured from "noon minus 12h" (effectively
                         midnight, except for days on which daylight savings time changes occur) at the
                         beginning of the service day. For times occurring after midnight on the service day, the
                         time is a value greater than 24:00:00 in HH:MM:SS local time for the day on which the
 departure_time          trip schedule begins.                                                                            10       Text
                         The stop_id field contains an ID that uniquely identifies a stop. Multiple routes may use
 stop_id                 the same stop. The stop_id is referenced from the stops.txt file.                                        Number
 stop_sequence           The stop_sequence field identifies the order of the stops for a particular trip.                         Number
                         The stop_headsign field contains the text that appears on a sign that identifies the trip's
 stop_headsign           destination to passengers.                                                                       100      Text
                         The pickup_type field indicates whether passengers are picked up at a stop as part of the
                         normal schedule or whether specific arrangement of a pickup at the stop is applicable.
                         Possible values include:
                         0 - Regularly scheduled pickup
                         1 - No pickup available
                         2 - Must phone agency to arrange pickup
 pickup_type             3 - Must coordinate with driver to arrange pickup                                                        Number
                         The drop_off_type field indicates whether passengers are dropped off at a stop as part of
                         the normal schedule or whether specific arrangement of a drop off at the stop is
                         applicable.Possible values include:
                         0 - Regularly scheduled drop off
                         1 - No drop off available
                         2 - Must phone agency to arrange drop off
 drop_off_type           3 - Must coordinate with driver to arrange drop off                                                      Number
                         The timepoint field is used to indicate if the specified arrival and departure times for a
                         stop are strictly adhered to by the transit vehicle or if they are instead approximate and/or
                         interpolated times. Possible values include:
                         0 – Estimated timepoint
 timepoint               1 – Designated timepoint                                                                                 Number


                                                                                  Page 6 of 13

PDF page 7

6.   CALENDAR
         File: CALENDAR.TXT


 ITEM NAME              DESCRIPTION                                                                                       WIDTH   TYPE
                        The service_id contains an ID that uniquely identifies a set of dates when service is
                        available for one or more routes. Each service_id value can appear at most once in a
 service_id             calendar.txt file. This value is dataset unique. It is referenced by the trips.txt file.                  Number
                        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.)
 monday                 A value of 0 indicates that service is not available on Mondays in the date range.                        Number
                        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.)
 tuesday                A value of 0 indicates that service is not available on Tuesdays in the date range.                       Number
                        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.)
 wednesday              A value of 0 indicates that service is not available on Wednesdays in the date range.                     Number
                        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.)
 thursday               A value of 0 indicates that service is not available on Thursdays in the date range.                      Number
                        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.)
 friday                 A value of 0 indicates that service is not available on Fridays in the date range.                        Number
                        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
 saturday               range is specified using the start_date and end_date fields.)                                             Number
                                                                                 Page 7 of 13

PDF page 8

             A value of 0 indicates that service is not available on Saturdays in the date range.
             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.)
sunday       A value of 0 indicates that service is not available on Sundays in the date range.                 Number
             The start_date field contains the start date for the service. The start_date field's value is in
start_date   YYYYMMDD format.                                                                                   Number
             The end_date field contains the end date for the service. This date is included in the service
end_date     interval. The end_date field's value is in YYYYMMDD format.                                        Number




                                                                      Page 8 of 13

PDF page 9

7.   CALENDAR_DATES
         File: CALENDAR_DATES.TXT


 ITEM NAME              DESCRIPTION                                                                                     WIDTH   TYPE
                        The service_id contains an ID that uniquely identifies a set of dates when a service
                        exception is available for one or more routes. Each (service_id, date) pair represents a
                        unique record in calendar_dates.txt. If the a service_id value appears in both the
                        calendar.txt and calendar_dates.txt files, the information in calendar_dates.txt modifies the
 service_id             service information specified in calendar.txt. It is referenced by the trips.txt file.                  Number
                        The date field specifies a particular date when service availability is different than the
 date                   norm. The date field's value is in YYYYMMDD format.                                                     Number
                        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.
 exception_type         A value of 2 indicates that service has been removed for the specified date.                            Number




                                                                                Page 9 of 13

PDF page 10

8.   FREQUENCIES
         File: FREQUECIES.TXT

 ITEM NAME             DESCRIPTION                                                                                      WIDTH   TYPE
                       The trip_id contains an ID that identifies a trip on which the specified frequency of service
 trip_id               applies. Trip IDs are referenced from the trips.txt file.                                         20      Text
                       The start_time field specifies the time at which the first vehicle departs from the first stop
                       of the trip with the specified frequency. The time is measured from "noon minus 12h"
                       (effectively midnight, except for days on which daylight savings time changes occur) at the
                       beginning of the service day. For times occurring after midnight, the time is a value greater
                       than 24:00:00 in HH:MM:SS local time for the day on which the trip schedule begins. E.g.
 start_time            25:35:00.                                                                                         10      Text
                       The end_time field indicates the time at which service changes to a different frequency (or
                       ceases) at the first stop in the trip. The time is measured from "noon minus 12h"
                       (effectively midnight, except for days on which daylight savings time changes occur) at the
                       beginning of the service day. For times occurring after midnight, the time is a value greater
                       than 24:00:00 in HH:MM:SS local time for the day on which the trip schedule begins. E.g.
 end_time              25:35:00.                                                                                         10      Text
                       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.
 headway_secs          The headway value is presented in number of seconds.                                                     Number




                                                                                 Page 10 of 13

PDF page 11

9.   FARE_ATTRIBUTES
         File: FARE_ATTRIBUTES.TXT

 ITEM NAME             DESCRIPTION                                                                                      WIDTH   TYPE
                       The fare_id field contains an ID that uniquely identifies a fare class. The fare_id is dataset
                       unique. The fare_id is composed of: (1) route id; (2) route bound; (3) pick-up stop
                       sequence; (4) drop-off stop sequence. Route id and route bound can be correlated in pair
                       with route id and route_seq in <Routes and fares of public transport> dataset disseminated
 fare_id               via Data.gov.hk.                                                                                  20      Text
 price                 The price field contains the fare price, in the unit specified by currency_type.                         Number
                       The currency_type field defines the currency used to pay the fare, which is represented by
                       ISO 4217 alphabetical currency codes at the following URL:
 currency_type         http://en.wikipedia.org/wiki/ISO_4217.                                                            10      Text
                       The payment_method field indicates when the fare must be paid. Valid values for this field
                       are:
                       * 0 - Fare is paid on board.
 payment_method        * 1 - Fare must be paid before boarding.                                                                 Number
                       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.
 transfers             * (empty) - If this field is empty, unlimited transfers are permitted.                                   Number
                       Required for feeds with multiple agencies defined in the agency.txt file. Each fare attribute
 agency_id             must specify an agency_id value to indicate which agency the fare applies to.                     10      Text




                                                                                 Page 11 of 13

PDF page 12

10. FARE_RULES
        File: FARE_RULES.TXT

ITEM NAME             DESCRIPTION                                                                                  WIDTH   TYPE
                      The fare_id field contains an ID that uniquely identifies a fare class. This value is
fare_id               referenced from the fare_attributes.txt file.                                                 20      Text
                      The route_id field associates the fare ID with a route. Route IDs are referenced from the
route_id              routes.txt file.                                                                                     Number
                      The origin_id field associates the fare ID with an origin zone ID. Zone IDs are referenced
origin_id             from the stops.txt file.                                                                             Number
                      The destination_id field associates the fare ID with a destination zone ID. Zone IDs are
destination_id        referenced from the stops.txt file.                                                                  Number




                                                                              Page 12 of 13

PDF page 13

Entity Relationship Diagram




                              Page 13 of 13

Figure note, from visual inspection:
The entity relationship diagram shows agency, routes, trips, stops, stop_times, frequencies, calendar, calendar_dates, fare_attributes and fare_rules. In the diagram, trips refer to routes and calendar; stop_times refer to trips and stops; frequencies refer to trips. Fare rules refer to a fare, route and origin/destination stops. Consult the source drawing for the exact key annotations.

Source diagrams

相關資料集
其他格式

Markdown · 詮釋資料 JSON

擷取文字;版面及圖表請參閱官方 PDF。

來源及使用條款

Publisher listed by DATA.GOV.HK: Transport Department. Follow the original source PDF linked on this record.

Locate an applicable current public-reuse notice or obtain publisher clarification for the exact documentation; retain metadata and official source references in the meantime.

Publisher-independent publication is the user's editorial instruction. Recorded publisher classifications do not determine selection. It does not establish per-document legal clearance or a publisher permission grant.

No publisher-wide copyright or document-specific reuse scope has been established.

Official source PDF remains authoritative. Automatic extraction can omit or misformat content.

Source PDF SHA-256: 3a581d2775fed0a6e5b08f0c2736ca73df9433c9874c8c98b437287e7f5a61b8.

Publisher listed by DATA.GOV.HK and original source PDF are identified on this copy. Publisher listing does not establish authorship.

Rights in the original source material remain with its rights holders. Editorial selection does not establish a publisher permission grant or per-document legal clearance. Consult the original PDF and recorded terms.

This is a Markdown text conversion with formatting changes. The official source PDF remains authoritative. No provider endorsement is claimed.

This copy supports noncommercial educational reference to help readers understand and use upstream schemas and APIs. This project purpose does not restrict rights granted by the provider licence.

Reuse evidence