GTFS Stops To Features (Public Transit)

Summary

Converts a GTFS stops.txt file from a GTFS public transit dataset to a feature class of public transit stops.

Usage

  • A file geodatabase feature class is recommended for tool output instead of a shapefile because shapefile field names have a maximum of 10 characters. Longer GTFS field names will be shortened if the output table is a shapefile.

  • To edit GTFS stop locations and attributes, use this tool to import an existing stops.txt file, make edits in the map, and export the edited table back to GTFS format using the Features To GTFS Stops tool.

  • The stop_lat and stop_lon fields in the GTFS stops.txt file define the latitude and longitude of stops. These fields are permitted by the specification to be null if the stop's location_type field has a value of 3 or 4. However, because this tool creates geographical features to represent stops, it cannot map stops that have no latitude or longitude. Consequently, stops with location_type values of 3 or 4 that have null values for stop_lat or stop_lon will be skipped and not included in the tool's output.

  • When the folder containing the input_stops.txt file also includes GTFS stop_times.txt, trips.txt, and routes.txt files, a route_info field will be added to the output. This field will contain information about the GTFS routes that use each stop. The field values are JSON strings consisting of the following keys and a list of values:

    • route_id—The route IDs the stop serves (GTFS route_id)
    • route_type—The modes of public transit that use the stop (GTFS route_type)

    For example, a value can be structured as {"route_id":["route_1","route_2","route_3"],"route_type":["0", "2"]}.

    This field can be parsed for use in symbology and pop-ups.

Parameters

LabelExplanationData Type
Input GTFS Stops File

A valid stops.txt file from a GTFS dataset.

File
Output Feature Class

The output feature class.

Feature Class

arcpy.transit.GTFSStopsToFeatures(in_gtfs_stops_file, out_feature_class)
NameExplanationData Type
in_gtfs_stops_file

A valid stops.txt file from a GTFS dataset.

File
out_feature_class

The output feature class.

Feature Class

Code sample

GTFSStopsToFeatures example (Python window)

The following code sample demonstrates how to use the GTFSStopsToFeatures function in the Python window.

arcpy.transit.GTFSStopsToFeatures(r"D:/GTFS/stops.txt", r"D:/Data/output.gdb/stops")

Environments

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics