Category: Tools

Improving transit: CTA launches train tracker

I was invited by Tony Coppoletta, External Electronic Communications Manager at the Chicago Transit Authority (CTA), and of recent Streetsfilms fame, to test and provide feedback on the new Train Tracker (still in beta). Launched to the public on Saturday, January 8, 2011, I peeked at it in mid-December, 2010.

Tony first showed us the website version and how it had slick transitions between updates (every 30 seconds). As you might expect, the mobile version looked great on the iPhone and Droid smartphones. I was more concerned about how it would look on my Opera Mini web browser on my Samsung Slash from Virgin Mobile*. I tediously entered the URL (mobile site) on my T9 keyboard and selected a station on the Red Line.

I was excited that it loaded quickly and looked completely normal and like its full-web browser counterparts. That’s to be expected when you design using web standards. Kevin Forsyth discussed the design further:

…it’s the layout of the site that really gets me going. It all feels so immediately familiar, because it closely adheres to CTA’s current graphic design standards for the system as a whole. Station names are displayed in white Helvetica on a dark grey background. All the colors of the train lines are spot-on likenesses of their printed versions, not just web-standard blue, green, orange, etc.

The mobile version of the site is a clean, stripped-down version of the same, and fits nicely onto a first-generation iPhone screen. It’s so neatly arranged, in fact, that I doubt an actual iPhone app could improve on its appearance.

It doesn’t look perfect on my tinny screen though – some elements are pushed to the next line and the boxes don’t expand to include them, but the readability remains. I was extremely impressed and had very limited feedback – I think the CTA’s internal testing efforts gave the public a wonderful “first version” product that I thought could have been launched right then and there in mid-December.

I’ve only tested the predictions (or “estimator” as Kevin calls it) a few times and so far it’s been accurate. The CTA does expect to offer a Train Tracker API just like it offers for Bus Tracker. Have you tried Train Tracker yet? What do you think?

To use CTA Train Tracker on your web-enabled phone (should work in most browsers), go to http://m.transitchicago.com and select “Train Tracker” (first item in the list).

Select your route.

Then select your station.

And view 15 minutes of upcoming train times.

*I prepay for Virgin Mobile phone service (Sprint owns Virgin Mobile) at a cost of $27 (including tax) per month that gives me 300 voice minutes, and unlimited messaging and data/internet. I highly recommend it. Virgin offers Blackberry, Android, and other smartphones.

Bike crash reporting tool: I receive a response to my FOIA request

UPDATE 12-15-10: I forgot to add that the letter stated that the Freedom of Information Act doesn’t require the responding agency to create new datasets or records where one doesn’t already exist. This means that if what you ask for doesn’t exist in their databases or file cabinets, the agency is not about to filter or search through existing data to create a custom set for you.

I continue to prepare to create a bicycle crash reporting tool (or web application). Here are the previous posts. Readers have sent me many great suggestions and concerns about how to create it, what data to use, and how to present such data. I don’t expect to begin any demonstrable work on this until mid-January when I return from my 21-day European vacation.

Today I received a response letter from the Chicago Police Department regarding my recent FOIA request for bicycle crash data.

This was disappointing: “After a thorough search, it was determined that the Department has no existing record responsive to your request.” I thought, “that doesn’t seem right. They don’t make reports on bicycle crashes?”

Police respond to a bicycle crash in Newberg, Oregon. Photo by Matt Haughey.

The letter later states, “The Department  does not currently possess a record which aggregates bicycle crash data.” Ah, this means something now. It seems that while the Chicago Police Department does make reports on bicycle crashes, it doesn’t keep a running tally or stored database query which it can use to produce the data I want – what I want would require a little more work, I guess.

The final paragraph does recommend that I contact the Illinois Department of Transportation Division of Traffic Safety’s Crash Reporting Section, where the police forward their reports. It turns out that I already received crash data on IDOT and I’m “playing around with it” using Google’s Fusion Tables.

3D experimentation to improve pedestrian environment

3D experimentation to improve pedestrian environment from Steven Vance on Vimeo.

The movies aren’t the only place where you’ll see in 3D! Go check out Clark and Deming (about 2540 N Clark Street) in the Lincoln Park neighborhood to see a special pedestrian safety marking on the pavement. They were installed on October 18, 2010.

Designed to increase nighttime visibility

Who’s involved?

  • Chicago Department of Transportation (CDOT)
  • National Highway Traffic Safety Administration (NHTSA)
  • Western Michigan University (WMU)

All three entities are involved in the installation of these optical illusion zig-zag markings.

Between and including years 2005 and 2009, there were at least 2 reports of injuries to people walking and at least 9 reports of collisions involving people riding bikes*. With that data in mind, I’m not sure why this location was selected for a pavement marking whose aim is to improve pedestrian safety. The data do indicate that this intersection has a lot of bicycle-related collisions, much more than I’m seeing for other intersections.

Clark and Deming

Curiously, there are no automobile traffic counts for miles in either direction on Clark Street so one cannot compare the number of collisions at the Clark and Deming intersection with other intersections in town. Out of over 1,200 count locations, Clark Street in Lincoln Park was skipped.

Not really stopping for pedestrians

*Data from the Illinois Department of Transportation Safety Data Mart (which was taken down in 2015 or 2016)

Obtaining Chicago Transit Authority geodata

A reader asked where they could get Chicago Transit Authority (CTA) data I didn’t already have on the “Find GIS data” page. I only had shapefiles for train lines and stations. Now I’ve got bus routes and stops.

You can download General Transit Feed Specification (GTFS) data from the CTA’s Developer Center. It’s updated regularly when service changes.

Screenshot from ESRI ArcMap showing the unedited shapes.txt file loaded via Tools>Add XY Data. Shapes.txt is an 18 MB comma-delimited text file with thousands of points that can be grouped together with their shape_id.

The GTFS has major benefits over providing shapefiles to the public.

  1. It can be easily converted to the common shapefile format, or KML format.
  2. Google, the inventor of GTFS, has defined and documented it well; it is unencoded and plaintext. These attributes make it easy for programmers and hackers to manipulate it in many ways. (see also item 4)
  3. Google provides a service to the public on its website, an easy to use and robust transit planning service.
  4. The data is stored as plaintext CSV files.
  5. While an agency like CTA may have a geodata server on its intranet, it is less likely it has the addons that provide mapping and geodata services for the internet. A server like Web Mapping Service, or ArcIMS. These systems can be expensive to purchase and license. And we all know how the CTA seems to always be in a money crunch. While the CTA updates its GTFS data for publishing to Google Maps, the public can download it simultaneously to always have up-to-date information, providing the same geodata that ArcIMS or WMS would offer but for no additional cost.

I couldn’t have pulled off this conversion in 24 hours without the help of Steven Romalewski’s blog, Spatiality. He pointed me to the right ArcMap plugin in this post about converting the Metropolitan Transportation Authority’s GTFS data into shapefiles. I hope Steven doesn’t move to Chicago less my authority on GIS and transit be placed in check!

Make your own map of the CTA train routes and perform some kind of analysis – then share it with the rest of us!

Read more about my exercise in geodata conversion in the full post.
Continue reading

How to convert GTFS to GIS shapefiles and KML

This tutorial will teach how you to convert any transit agency’s General Transit Feed Specification (GTFS) data into ESRI ArcGIS-compatible shapefiles (.shp), KML, or XML. This is simple to do because GTFS data is essentially a collection of CSV (comma separated values) text files (really, really large text files).

Note: I don’t know how to do the reverse, converting shapefiles or other geodata into GTFS data. I’m not sure if this is possible and I’m still investigating it. If you have tips, let me know.

Converting GTFS to GIS shapefiles

Instructions require the use of ArcGIS (Windows only) and a free plugin called ET GeoWizards GIS for any version of ArcGIS. I do not have instructions for Mac users at this time.

I wrote these instructions while converting the Chicago Transit Authority’s GTFS files into shapefiles based on a reader’s request. “Field names” are quoted and layer names are italicized.

  1. Download the GTFS data you want. Find data from agencies around the world (although not many from Europe) on GTFS Data Exchange.
  2. Import into ArcGIS the shapes.txt file using Tools>Add XY Data. Specify Y=lat and X=lon
  3. Using ET GeoWizards GIS tools, in the Convert tab, convert the points shapefile to polyline.
  4. Select the shapes layer in the wizard, then create a destination file. Click Next.
  5. Select the “shape_id” field
  6. Click the checkbox next to Order and select the field “shape_pt_sequence” and click Finish.
  7. Depending on the number of records (the CTA has 466,000 shapes), it may take a while.
  8. The new shapefile will be added to your Table of Contents and appear in your map.
  9. Import the trips.txt and routes.txt files. Inspect them for any NULL values in the “route_id” field. You will be using this field to join the routes and trips table. It may be a case that ArcGIS imported them incorrectly; the text files will show the correct data. If NULL values appear, follow steps 10 and 11 and continue. If not, follow steps 10 and 12 and continue. This happens because ArcGIS inspected some of the data and determined they were integers and ignored text. However, this is not the case.
  10. Export the text files as DBF files so that ArcGIS operates on them better. Then remove the text files from the Table of Contents.
  11. (Only if NULL values appear) Go into editing mode and fix the NULL values you noticed in step 9. You may have to make a new column with a more forgiving data type (string) and then copy the “route_id” column into the new column. Then continue to step 12.
  12. Join routes and trips based on the field “route_id” – export as trips_routes.dbf
  13. Add a new column to shapes.shp called “shape_id2”, with data type double 18, 11. This is so we can perform step 14. Use the field calculator to copy the values from “shape_id” (also known as ET_ID) to “shape_id2”
  14. Join routes_trips with shapes into routes_poly based on the field “shape_id” (and “shape_id2”)
  15. Dissolve routes_poly on “route_id.” Make sure all selections are cleared. Use statistics/summary fields: “route_long,” “route_url.” Save as routes_diss.shp
  16. Inspect the new shapefile to ensure it was created correctly. You may notice that some bus routes don’t have names. Since these routes are well documented on the CTA website, I’m not going to fill in their names.

Click on the screenshot to see various steps in the tutorials.

Converting GTFS to KML

After you have it in shapefile form, converting to KML is easy – follow these instructions for using QGIS. Or if you want to skip the shapefile-creation process (quite involved!), you can use KMLWriter, a Python script. Also, I think the latest version of ArcGIS has built-in KML exporting.

Converting GTFS to XML

If you want to convert the GTFS data (which are essentially comma-separated value – CSV – files) to XML, that’s easier and you can avoid using GIS programs.

  • First try Mr. Data Converter (very user friendly).
  • If that doesn’t work, try this website form on Creativyst. I tested it by converting the CTA’s smallest GTFS table, frequencies.txt, and it worked properly. However, it has a data size limit. (User friendly.)
  • Next try csv2xml, a command line tool. (Not user friendly.)
  • You can also use Microsoft Excel, but read these tips and caveats first. (I haven’t found a Microsoft application I like or think is user friendly.)