GTFS Shapes To Features (Conversion)


Converts a GTFS shapes.txt file from a GTFS public transit dataset to a polyline feature class showing the physical paths taken by vehicles in the public transit system.

If possible, attributes from the routes.txt file are included for each shape in the output, and output lines are symbolized according to the color specified in the route_color field.

The shapes.txt file contains sequences of latitude and longitude points. This tool generates shape polylines by connecting these sequences of points with straight lines.


The GTFS Shapes To Features tool and the Generate Shapes Features From GTFS tool are used for different purposes. Use GTFS Shapes To Features if your GTFS dataset includes an existing shapes.txt file and you want to convert these shapes to a feature class to display in the map. Use Generate Shapes Features From GTFS if your GTFS dataset does not include an existing shapes.txt file and you want to estimate the shapes based on the other information contained in the GTFS dataset and create a shapes.txt file.


  • Route attributes will be populated only if valid trips.txt and routes.txt files are located in the same folder as the input shapes.txt file.

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

  • Route attributes are populated for each shape using the following process: For each shape_id in the shapes.txt file, the tool checks the trips.txt file to find the trips with this shape_id and finds the route_id associated with these trips. The tool then retrieves the attributes for that route_id from the routes.txt file and puts these attributes in the output feature class of shapes. In the unusual case that more than one route_id is associated with a given shape_id, the shape will be duplicated in the output feature class so that there is one feature for each unique shape_id and route_id pair.


LabelExplanationData Type
Input GTFS Shapes File

A valid shapes.txt file from a GTFS dataset.

Output Feature Class

The output feature class.

Feature Class

arcpy.conversion.GTFSShapesToFeatures(in_gtfs_shapes_file, out_feature_class)
NameExplanationData Type

A valid shapes.txt file from a GTFS dataset.


The output feature class.

Feature Class

Code sample

GTFSShapesToFeatures example (Python window)

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


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.GTFSShapesToFeatures(r"D:/GTFS/shapes.txt", r"D:/Data/output.gdb/shapes")


Licensing information

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