Features To GTFS Stops (Conversion)

Summary

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

Usage

  • A file geodatabase feature class is recommended for tool input instead of a shapefile because some field names allowed by the GTFS specification are longer than the maximum of 10 characters allowed for shapefile field names.

  • The output stops.txt file's stop_lat and stop_lon fields will be populated using the geometry of the input features. If the input feature class contains stop_lat and stop_lon fields, the values in those fields will be ignored.

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

  • This tool does not do comprehensive data validation. Confirm that the resulting GTFS stops.txt file is valid according to the GTFS specification.

Parameters

LabelExplanationData Type
Input Features

A point feature class containing transit stop geometries and at least the minimum required GTFS stops.txt file fields except stop_lat and stop_lon.

Feature Layer
Output GTFS Stops File

The output stops.txt file.

File

arcpy.conversion.FeaturesToGTFSStops(in_features, out_gtfs_stops_file)
NameExplanationData Type
in_features

A point feature class containing transit stop geometries and at least the minimum required GTFS stops.txt file fields except stop_lat and stop_lon.

Feature Layer
out_gtfs_stops_file

The output stops.txt file.

File

Code sample

FeaturesToGTFSStops example (Python window)

The following code sample demonstrates how to use the FeaturesToGTFSStops tool in the Python window.

Legacy:

This tool was moved to the Public Transit Tools toolbox at ArcGIS Pro 2.9. The syntax in the code sample uses the transit toolbox alias associated with the tool's new location. However, the conversion toolbox alias continues to work. You do not need to modify existing scripts, but you should use the transit alias for new scripts.

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

Environments

Licensing information

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