This Generate GTFS Shapes tool mentioned in this post is now deprecated because the functionality is now included in ArcGIS Pro 2.6. To create a shapes.txt file for your GTFS dataset in ArcGIS Pro 2.6 and higher, please use the Generate Shapes Feature From GTFS and Features To GTFS Shapes tools in the Conversion Tools toolbox.
GTFS public transit data has transformed the world of public transit navigation. Thanks to readily-available transit data in a standardized format, passengers can choose from a wide range of routing apps and services that help them figure out which bus or train to take and plan how long their journey will take.
Consequently, if you’re a public transit agency, it’s in your best interest to make your GTFS data as high quality as possible. All those routing apps can only be as good as the underlying data! Check out the GTFS Data Best Practices guide for advice on how to make your GTFS data excellent.
You can use ArcGIS to improve your GTFS data! You can update your stop locations with the free downloadable Edit GTFS Stop Locations tool. You can also create a shapes.txt file, or update some of your existing shapes, using the free downloadable Generate GTFS Shapes tool, which is what the rest of this blog post is going to be about.
The GTFS shapes.txt file contains the actual geographic paths taken by your transit vehicles (buses, trains, etc.). The shapes.txt file is optional, but it’s important to have it so that routing apps can display the transit data nicely in a map and show an accurate representation of where your routes are.
A shapes.txt file contains series of latitude/longitude points describing each unique “shape” in your transit system. A shape corresponds to a particular sequence of stops. You should have a unique shape_id for each unique sequence of stops in your transit system, which may or may not correspond exactly to the number of routes you have. Some routes might require multiple shapes. For example, half of the Bus 12 trips may divert to one end station, and the other half may end somewhere else, so you would need two different shapes to model that. Also, if Bus 12 goes in both directions, you would need a separate shape for each direction, so four in total because of the two end stations.
Many agencies create shapes.txt files using the GPS tracks from their AVL systems or from various route planning software packages that export GTFS. But if neither of these is an option for your agency, or if you’re unhappy with the results, give Generate GTFS Shapes a try. You can download the tool for free using the link above and run the tool in ArcMap or ArcGIS Pro.
To use the tool, download it, unzip it, and follow the user’s guide included in the download and available online. The first part of the tool gives you several options to generate an estimate of your shapes. Then, you can manually edit the shapes in the map to get them exactly how you want them. Finally, run the second part of the tool to export your shapes into GTFS format. You can also just update a shape or two in your existing shapes.txt file if that’s all you need to do.
How does the tool work? It reads your GTFS data to find all the unique sequences of stops, and for each one, it uses the Network Analyst Route solver to calculate the optimal route along the street network to visit the stops in the correct order. The tool can either use the ArcGIS Online route service or run the calculation on your own machine with your own network dataset, depending on the settings you choose. The tool can also generate shapes by just connecting the stops with simple straight lines. You can choose to generate some shapes using on-street routes (like for all the buses) and use straight lines for other modes (like subways and ferries). You can fine tune the results using several other options that are described in more detail in the user’s guide.
(Since people always ask: No, sorry, the tool doesn’t allow you to create a shapes.txt file from an existing feature class of transit lines. In order to ensure that all the information necessary for high-quality GTFS data is present, you have to use the first part of this tool to generate the estimated shapes.)
We hope this tool will help your transit agency create a high quality shapes.txt file so that routing apps will render your transit lines accurately. Remember, a high quality GTFS dataset is important for happy and efficient riders!