Tag: CTA

Converting a transit agency’s GTFS to shapefile and GeoJSON with QGIS

Many years ago I wrote a tutorial on how to use an ArcGIS plugin to convert a transit agency’s GTFS package – a group of files that describe when and where their buses and trains stop – into files that could easily be manipulated by popular GIS desktop software.

That was so long ago, before I became an expert in using QGIS, a free and open source alternative to ArcGIS.

This tutorial will show you how to convert GTFS to a shapefile and to GeoJSON so you can edit and visualize the transit data in QGIS.

Prerequisites

First you’ll need to have QGIS installed on your computer (it works with Linux, Mac, and Windows). Second you’ll need a GTFS package for the transit agency of your choice (here’s the one for Pace Suburban Bus*, which operates all suburban transit buses in Chicagoland). You can find another transit agency around the world on the GTFS Data Exchange website.

Section 1: Let’s start

  1. Open QGIS.
  2. Load your GTFS data into the QGIS table of contents (also called the Layers Panel). Click Layer>Add Layer>Add Delimited Text Layer. You will be adding one or two files depending on which ones are provided.

    QGIS add delimited text layer

    Add delimited text layer.

  3. Now, here it can get tricky. Not all transit agencies provide a “shapes.txt” file. The shapes.txt file draws out the routes of buses and trains. If it’s not provided, that’s fine, but if you turn them into routes based on the stops.txt data, then you will have funny looking and impossible routes.

    QGIs browse for the stops.txt file

    Browse for the stops.txt file

  4. Click on “Browse…” and find the “stops.txt”. QGIS will read the file very quickly and determine which fields hold the latitude and longitude coordinates. If its determination is wrong, you can choose a different “X field” (longitude) and “Y field” (latitude).
  5. Click “OK”. A new dialog box will appear asking you to choose a coordinate reference system (EPSG). Choose or filter for “WGS 84, EPSG:4326”. Then click “OK”.
  6. The Pace bus stops in the Chicagoland region are now drawn in QGIS!

    Pace bus stops are shown

    Pace bus stops are shown

  7. If the GTFS package you downloaded includes a “shapes.txt” file (that represents the physical routes and paths that the buses or trains take), import that file also by repeating steps 4 and 5.

Section 2: Converting the stops

It’s really easy now to convert the bus or train stops into a shapefile or GeoJSON representing all of those points.

  1. Right-click the layer “stops” in the table of contents (Layers Panel) and click “Save As…”.
  2. In the “Save vector layer as…” dialog box, choose the format you want, either “ESRI Shapefile” or “GeoJSON”. **
  3. Then click “Browse” to tell QGIS where in your computer’s file browser you want to save the file. Leave the “CRS” as-is (EPSG:4326).

    Convert the bus stops to a shapefile or GeoJSON.

    Convert the Pace bus stops to a shapefile or GeoJSON.

  4. Then click “OK” and QGIS will quickly report that the file has been converted and saved where you specified in step 3.

Section 3: Converting the bus or train routes

The “shapes.txt” file is a collection of points that when grouped by their route number, show the physical routes and paths that buses and trains take. You’ll need a plugin to make the lines from this data.

  1. Install the plugin “Points to Paths”. Click on Plugins>Manage and Install Plugins… Then click “All” and search for “points”. Click the “Points to Paths” plugin and then click the “Install plugin” button. Then click “Close”.

    Install the Points to Paths plugin.

    Install the Points to Paths plugin.

  2. Pace bus doesn’t provide the “shapes.txt” file so we’ll need to find a new GTFS package. Download the GTFS package provided by the Chicago Transit Authority, which has bus and rail service in Chicago and the surrounding municipalities.
  3. Load the CTA’s “shapes.txt” file into the table of contents (Layers Panel) by following steps 4 and 5 in the first section of this tutorial.  Note that this data includes both the bus routes and the train routes.

    QGIS load CTA bus and train stops

    Import CTA bus and train stops into QGIS

  4. Now let’s start the conversion process. Click on Plugins>Points to Paths. In the next dialog box choose the “shapes” layer as your “Input point layer”.
  5. Select “shape_id” as the field with which you want to “Point group field”. This tells the plugin how to distinguish one bus route from the next.
  6. Select “shape_pt_sequence” as the field with which you want to “Point order field”. This tells the plugin in what order the points should be connected to form the route’s line.
  7. Click “Browse” to give the converted output shapefile a name and a location with your computer’s file browser.
  8. Make sure all  of the options look like the one in this screenshot and then click “OK”. QGIS and the plugin will start working to piece together the points into lines and create a new shapefile from this work.

    These are the options you need to set to convert the CTA points (stops) to paths (routes).

    These are the options you need to set to convert the CTA points to paths (routes).

  9. You’ll know it’s finished when the hourglass or “waiting” cursor returns to a pointer, and when you see a question asking if you would like the resulting shapefile added to your table of contents (Layers Panel). Go ahead and choose “Yes”.

    QGIS: CTA bus and train points are converted to paths (routes)

    The CTA bus and train points, provided in a GTFS package, have been converted to paths (routes/lines).

  10. Now follow steps 1-4 from Section 3 to convert the routes/lines data to a shapefile or GeoJSON file.**

Notes

* As of this writing, the schedules in Pace’s GTFS package are accurate as of January 18, 2016. It appears their download link always points to the latest version. Transit schedules typically change several times each year. Pace says, “Only one package is posted at any given time, typically representing Pace service from now until a couple of months in the future. Use the Calendar table to see on which days and dates service in the Trips table are effective.”

** Choose GeoJSON if you want to show this data on a web map (like in Leaflet or the Google Maps API), or if you want to share the data on GitHub.

The new CTA budget

[I published an edited version of this post on Streetsblog Chicago.]

The Chicago Transit Authority gleefully tweeted that “fares [will] stay the same” and they’ll continue to “maintain/improve existing services”.

There are so many points to be made.

The medium on which they sent this message is irrelevant because Mayor Rahm Emanuel will parrot this at his press conference this afternoon at the Addison Blue Line station. He’ll say something that he’s holding fares down in order to support working families, yet he (because he runs the agency) can still get projects done, like renovating the Addison station to be accessible.

Fares should go up frequently, instead of making big jumps every 3-5 years. The price of things changes much more frequently and it’s what an agency providing such an important transportation service needs to do to be less constrained in making buses and trains run. And planning and funding for more buses and trains, under the strain of growing ridership. The CTA has the expertise to develop a long-term plan that sets out fare increases annually, removing the surprise, “Will this be the year?”

Fares should go up in increments smaller than quarters of a dollar! 0.25, 0.50, 0.75, and 1.00 are not the only choices available. Requiring riders who pay in cash – who become rarer each day – to pay with dollar bills and quarters isn’t a “convenience”, it’s annoying. It gives the CTA less flexibility in settling on the right price, and it means I can’t use these dimes and nickels that are piling on my nightstand. Quarters are for laundry.

“Fares will stay the same” is what Emanuel said two years ago when the price of passes was increased. Apparently causing people to spend more money to ride the train the same amount of times, if they have passes, is not a fare increase. This year none of the prices are changing. Hiking pass prices and keeping the base fare (single rides + transfers) the same can still hurt a low income rider: it puts the discounted fare further out of reach. Many Chicagoans are unable to put down $25 at a time for a ticket that would pay for all of their rides that week, so they pay per use, and end up paying more.

What holding the line on fare increases does is detrimental to riders and to CTA workers. It continues to defer fixing the problem of underfunded transit. The CTA, and its fellow transportation providers, Metra and Pace, are unable to pay for what people need them to do.

Additionally it’ll mean that, in order to keep costs in check, the CTA might freeze wages again. Because professionals providing Chicagoans with quality transportation services are the city’s and state’s piggy bank, and should sacrifice their wages due to “hard times”.

That’s the problem to be dealt with “soon”, but there’s an immediate problem, that Jon Hilkevitch explains in the Tribune:

The governor and lawmakers in Springfield have not agreed on a 2016 budget and the state still owes the CTA $221 million in capital-improvement funding that was expected in 2015, transit officials said.

But hey, “air quality” money is going to pay $18 million to widen a bunch of intersections so people can drive faster through them – until more people switch to driving through that fast intersection.

Chicago’s TOD rule is the only reason multi-family is being built in neighborhoods

This is the ordinance that says residential developments have to provide 0.5 car parking spaces per home, and that the minimum home size can be smaller.

How many units? At least 1,500. Here’re the 19 buildings I know about that are being built within 600 and 1,200 feet* of a Chicago Transit Authority ‘L’ station – the only areas, essentially, where multi-family housing can be developed.

Why can’t dense housing be built elsewhere? Because the most desirable living areas in Chicago – along retail streets in Logan Square, North Center, Lincoln Park, Lakeview, and West Town – are zoned for single-family use. (And ad-hoc zoning districts taking the place of community land use planning.)

How do I know popular neighborhoods are zoned for single-family use? Because Daniel Hertz’s new Simplified Chicago Zoning Map makes it easy to see. Yep, even along those dense business districts and even outside the train stations.

Do the single-family home zones contain single-family homes now? Absolutely not! Much of the buildings in areas zoned for single-family homes have everything but! The particular view of the map that Hertz uses in his blog post shows that even adjacent to CTA stations, and within 1 block, there are only single-family zones (in red). There are many multi-family buildings in these red zones.

Red areas are zoned for single-family homes only.

Red areas are zoned for single-family homes only. View the map.

What ends up happening there? Teardowns. And the Lakeview Chamber of Commerce finds believes that non-matching zoning – it matches neither the existing uses nor the needs for the neighborhood – and teardowns are going to cut into consumer spending on its lively retail streets. Lakeview is seeing a population change to families which tend to have less disposable income.

More housing in a popular neighborhood means more shoppers, more property taxes, more “boots on the ground”, more “pedestrian congestion” in front of our local businesses.

Doesn’t the ordinance make station-adjacent parcels friendly to multi-family housing because of the TOD ordinance? Yes, and no. As Hertz points out, “virtually every sizable development involves a zoning variance or planned development process that goes beyond the zoning you’ll see on the map”.

The TOD ordinance is 19 months old and working exactly as intended, building more housing next to train stations, and giving more people the opportunity to have access to affordable transportation. So it needs an upgrade to be able to do more. Since, in Chicago, zoning is our land use plan, we need the best kind of zoning rules and this is one of the best.

Imagine what the TOD ordinance could do if it were expanded. Think, making the parking requirement relief and allowing different unit sizes by-right instead of going through an arduous and expensive zoning change process. Then, expanding the rule to include more than just 600 feet (which is less than a block) from a train station – people walk several blocks to get to CTA stations, and bike even more. And, beefing up the affordable housing requirements.

Let’s do this, Commissioner Andrew Mooney. Let’s do this, housing advocates. Let’s do this, transit advocates. I’m looking at you, Latin United Community Housing Association (LUCHA), Logan Square Neighborhood Association (LSNA), We Are/Somos Logan Square, Pilsen Alliance, Metropolitan Planning Council (MPC), Active Transportation Alliance, and the Center for Neighborhood Technology (CNT).

* The distance depends on existing Pedestrian Street zoning. If the property is on a designated Pedestrian Street then the station can be up to 1,200 for the ordinance to apply, double the normal 600 feet.

The CTA must remove the Clark Junction bottleneck to modernize the Red Line

CTA Belmont bypass rendering

A CTA rendering shows what a bypass track for Brown Line trains north of the Belmont station might look like, alongside a new residential building on Wilton Street.

Ed. note: This is a guest post from Chicagoan Jacob Peters.

“Keep the RPM Project on Track – Uncouple the [Belmont Bypass] Roller Coaster” is the tagline for a new website called “Coalition to Stop the Belmont Flyover”.

Capacity is constrained at the Chicago Transit Authority’s Clark Junction track interchange (at approximately 3300 N Clark Street) which means that fewer Red Line trains can run than could be run if there wasn’t this conflict. In the same way there are opportunity costs in business, there are opportunity delays that are caused by this constraint on rail capacity.

For example, if there was no conflict at Clark Junction, then five more trains an hour could pass through the Red Line subway. This would increase Red Line capacity by 25 percent during rush hour, and fewer passengers would be left waiting for a train to arrive with space for them to board.

The way the website advocates against eliminating the bottleneck is hypocritical to the tagline of “keeping the Red Purple Modernization project” on track. That project, which would completely replace all track, viaducts, and embankments north of X station, and rebuild most stations (as well as widening and extending platforms) is largely based on a future service pattern that would run more and longer trains in the busiest transit corridor of Chicago.

This capacity increase would reduce their average commutes by a few minutes. Since the trains wouldn’t have to be spread out in order to maintain gaps in service for the Brown Line trains that need to cross the Red Line at Clark Junction, average wait times between trains would drop all along the Red Line at rush hour, further reducing commute times.

Lastly, when either the Brown, Purple or Red Lines are experiencing delays, and trains get bunched together, these delays ripple through the other lines. This happens because when a queue of delayed Brown Line trains are making their way through Clark Junction, Red Line trains must be held in order to let the delayed trains through the junction in an attempt to keep things moderately on schedule. If there was a bypass of this junction for northbound Brown Line trains, then a delay on either line would not affect the other. This would result in fewer days in which your commute is delayed.

Future capacity needs and current delay reduction is what the Belmont Bypass attempts to address. There may be other ways to achieve this with other alternatives, but the bypass would be far and away the cheapest and could be implemented soonest. Unless you plan to propose alternative means of resolving these conflicts, and funding mechanisms to make them possible, you are not really advocating to keep the RPM on track. Because without untying Clark Junction there is no true modernization.

Runoff election

The RedEye published on Monday an overview of the transit platforms from the two mayoral candidates that have made it into a runoff. (Mayor Rahm Emanuel didn’t receive a sufficient number of votes, 50 percent +1, in the February 24 election.) Chuy Garcia released his transportation and infrastructure platform about two days before the election.

Garcia paints a beautiful transportation issues platform, but when faced with a truly transformative project he is unwilling to uphold his call for “reliable transportation”. I want to vote for him again, but if he keeps on watering down projects to a point of inefficacy then how are you going to convince anyone to expand transportation funding? How can I trust him to bring about the change is needed on other important issues if on the issue that he received a masters in, he is unwilling to apply best practices?

Emanuel and Garcia should avoid grandstanding on issues of transportation because opposing a necessary transportation investment for political reasons is to let down the electorate that you are campaigning to serve. For both traversing Ashland Avenue by transit and riding Brown, Red, and Purple Line trains through Clark Junction, there is no way to move more people reliably through these areas without infrastructure improvements. Garcia shouldn’t oppose projects without explaining his alternate plan to address the same issues and achieve similar benefits – otherwise there isn’t leadership.

Alternatives

There are few alternatives. First, you could study how to use the existing CTA land around the Belmont stop more efficiently and eliminate track conflicts. It would need to be studied whether a new northbound Brown Line track and platform just to the east and a few feet higher than the current track it shares with the Purple Line could allow for the Brown Line to get high early enough to bridge over the Red Line closer to School.

This option would spare the buildings on the commercial thoroughfare of Clark, and focus demolition on residential streets.  I am not sure if it is possible given how the Belmont station was reconstructed in 2009, but I don’t have a record of it being studied or laid out why it is not an option. Seeing as the anti-bypass group is claiming that the destruction on Clark would turn it into a “permanent under-El wasteland” I would think they would want to prove whether this is possible or not.

Secondly, any alternatives analysis process [which the CTA hasn’t conducted] would include studying a subway alternative for this portion of the Red Line. In the RPM’s subway alternative there was no need for the bypass. The CTA considered a subway from Loyola station to Belmont station, but never studied each section of the potential subway separately. I truly believe that a subway with a portal at Clark Street and a portal just north of Irving Park Road would eliminate the property acquisition, station constraint, and construction phasing issues to outweigh the increased cost of going underground, without needing to consider a two-track alternative.

There was a neighborhood proposal from the 1980s for a subway between Belmont Avenue and Irving Park Road which would act somewhat as a “flyunder”, so to speak. It would include a new Wrigley Field Station that could be built to handle more than the existing constrained Addison Red Line station, including a Purple Line stop in order to match the Purple Line limited service that stops at Sheridan that’s provided on select game days.

The “flyunder” could allow the CTA to forego the large amounts of property acquisition that would be required in order to straighten out the kinks in the elevated north of Belmont, and to smooth out the curve at Sheridan. The CTA could then sell land currently under the tracks for development. In order to see if this is now feasible given the way Belmont was rebuilt, the CTA would have to study whether a bilevel tunnel from Clark Junction to Irving Park would be possible under Clark Street, and parallel to Seminary Avenue.

There is also the alternative of proposing that eliminating the realignment of the Red Line, included in the Belmont Bypass literature, would be a way to eliminate the amount of buildings affected in the scope of the bypass.  But I think that is somewhat tied into the discussion about the other two alternatives. The point is that the elevated bypass is a simple (although in the CTA’s current process, clumsy) solution to the question of how do you eliminate the Clark Junction bottleneck and the unreliability in the system that it creates.