This tutorial will show you how to do the following in QGIS:
Import Stops.txt into QGIS and convert it into a point Shapefile
Join the stop-level frequency tables created in the previous tutorial to the Stops layer and visualize frequencies in multiple ways
This tutorial is intended for QGIS users at the level of "advanced beginner" or higher - basic familiarity with fundamental GIS concepts and the program itself will make this an easier overall experience. Visit their website to learn more about QGIS and how to set it up on your machine.
All of these steps can also be carried out in ArcGIS, but the tools/processes themselves may have different names, and the steps may be done in a different order.
If you want to map frequency data, make sure you carry out all the steps outlined in the previous tutorial on setting up GTFS data in Excel.
If you're solely interested in getting Stops.txt into QGIS, you can move on to the next step.
Create a new QGIS project. Set the projection and add the basemap of your choosing. Basemaps aren't required, but they're an easy way to check that the layers were imported successfully.
In the top bar of the QGIS user interface, select Add Layer → Add Delimited Text Layer.
Navigate to where Stops.txt is saved, and select it. Make sure that under "Geometry Definition", the "Point Coordinates" radio button is selected, and that the correct latitude and longitude fields from the .txt file are marked as the X and Y fields in the menu.
Then, click Add to add the layer to the map. Compare it to the basemap to make sure it loaded properly.
Once stops.txt has been successfully imported into QGIS, we’ll need to export the layer as a Shapefile - certain attributes can’t be edited in .txt files. This can be done easily - right-click on the stops layer, then Export → Save Features As.
In the menu that pops up, select “ESRI Shapefile” from the Format drop-down menu. Then, click the [...] box on the right side of the File Name field to navigate to the location where you want to save the shapefile, and give the file a new name.
Make sure that the box next to “Add saved file to map” at the bottom of the window is checked. Then, click OK.
Once the new stops Shapefile has been successfully added to the map, you can remove the original Stops.txt layer.
In the top bar of the QGIS user interface, select Add Layer → Add Delimited Text Layer.
Navigate to where the CSV is saved and select it. Make sure that under "Geometry Definition", the "No geometry (attribute-only table)" radio button is selected, as this CSV should not have any spatial information.
Then, click Add to add the layer to the map. It should show up in the left-hand Layers column as a table (like the one shown on the right).
Right-click on the stops shapefile layer, and select Properties. In the left-hand side of the pop-up menu, navigate to Joins (which has the blue arrow/triangle icon) and select the Green + button to add a vector join.
In the subsequent window that pops up, select the CSV that you plan to join to the stops layer under the Join Layer drop-down menu. The Join Field and Target Field should both be the stop_id - this is what ties together the stops layer with the frequency data contained in the CSV table.
At the bottom of the window, check the Custom field name prefix box and leave it blank - this will prevent QGIS from auto-filling it with the name of the CSV table, which will delete the existing field names.
Select OK to close out of this pop-up menu, then click Apply on the Joins menu - this will carry out the vector join.
Right-click on the stops layer and select Open Attribute Table to double-check that the table join succeeded. In the table on the right, you can see that hourly stop-level frequencies for Saturdays have been joined to the stops layer.
Once the join is complete, re-export the newly-joined layer as a new shapefile. This will solidify the join and permanently append the joined data to the stops layer, and allow you to perform additional queries and analysis on the layer that aren’t possible otherwise.
For more information on vector joins/table joins, see the QGIS documentation.
Once the stops layer and the CSV containing trip frequencies have been joined, right-click on the stops layer, select Properties → Layer Properties (the icon that looks like a paintbrush).
From the drop-down menu at the top, select Graduated.
From the Value drop-down, select the name of the field you wish to visualize (in this case, Weekday AM Peak trips).
From the Method drop-down, you can choose either Size or Color. The former will scale the points themselves based on their values, while the latter will change the color ramp.
There are many different ways to visualize frequency data, whether by size, color, or both! Experiment with different methods and see what kinds of schemes you can come up with - below are a few examples:
Stop-level AM Peak frequencies visualized by color
Stop-level AM Peak frequencies visualized by dot size
Stop-level AM Peak frequencies visualized by color and dot size