Screenshot 1: Showing how some streets are not being counted. There should be a yellow section of road between the two existing yellow road sections.
A friend recently asked me how many blocks of road are in his ward. He wanted to know so that he could measure how many blocks of streets would have [...]
Screenshot 1: Showing how some streets are not being counted. There should be a yellow section of road between the two existing yellow road sections.
A friend recently asked me how many blocks of road are in his ward. He wanted to know so that he could measure how many blocks of streets would have an older style of street lighting after X number of blocks receive the new style of street lighting. For this project, I used two datasets from Chicago’s open data portal: street center lines and wards. The output data is not very accurate as there may be some overlap and some uncounted street segments; this is likely due to a shortcoming in my process. I will show you how to find the number of blocks per ward using QGIS (download Quantum GIS, a free program for all OSes).
Here’s how I did it
- Load in the two datasets. Wards and street center lines (zipped shapefiles). They are projected in EPSG:3435.
- Exclude several road classifications in the street center lines by querying only for
"CLASS" > '1' AND "CLASS" < '5'. The data dictionary for the road classifications is at the end. We don’t want the river, sidewalks, expressways, and any ramps to be included in the blocks per ward analysis. - Intersect. In QGIS, select Vector>Geoprocessing Tools>Intersect. The input vector layer is “Transportation” (the name of the street center lines dataset) and the intersect layer is “Wards”. Save the resulting shapefile as “streets intersect wards”. Click OK. This will take a while.
- Add the “streets intersect wards” shapefile to the table of contents.
- You’ll notice some of the issues with the resulting shapefile: missing street segments (see screenshot 1). What should QGIS do if a street is a ward boundary?
- Obtain street length information, part 1. Remove all the columns in the “streets intersect wards” shapefile that have something to do with geometry. These are now outdated and will confuse you when you add a geometry column generated by QGIS.
- Obtain street length information, part 2. With the “streets intersect wards” shapefile selected in the table of contents, select Vector>Geometry Tools>Export/Add geometry columns. Select “streets intersect wards” shapefile as your input layer, leave CRS as “Layer CRS” and save as new shapefile “streets intersect wards geom”.
- Add the “streets intersect wards geom” shapefile to the table of contents.
- You will see a new column at the end of the attribute table called LENGTH. Since the data is projected in EPSG:3435 (Illinois StatePlane NAD83 East Feet), the unit is feet.
- Simply export “streets intersect wards geom” to a CSV file and open the CSV file in a spreadsheet application. From there you can group the data by Ward number and add the street lengths together. (I thought it would be faster to do this in a database so I imported it into a localhost MySQL database and ran a simple query,
SELECT wardNum, sum(`chistreets_classes234`.`LENGTH`) as sum FROM chistreets_classes234 WHERE ward > 0 group by wardNum. I then exported this to a spreadsheet to convert feet to miles.)
Because of the errors described in step 5, you shouldn’t use this analysis for any application where accuracy is important. There are road lengths missing in the output dataset (table with street lengths summed by ward) and I cannot tell if the inaccuracy is equally distributed.
ward | length (feet) | length (miles) | percentage of total |
|---|---|---|---|
| 1 | 345807.34 | 65.49 | 1.61% |
| 2 | 604081.37 | 114.41 | 2.81% |
| 3 | 471370.83 | 89.27 | 2.19% |
| 4 | 312105.07 | 59.11 | 1.45% |
| 5 | 376239.82 | 71.26 | 1.75% |
| 6 | 519319.58 | 98.36 | 2.41% |
| 7 | 397117.42 | 75.21 | 1.84% |
| 8 | 567918.60 | 107.56 | 2.64% |
| 9 | 569327.91 | 107.83 | 2.64% |
| 10 | 707862.60 | 134.06 | 3.29% |
| 11 | 515253.87 | 97.59 | 2.39% |
| 12 | 324479.13 | 61.45 | 1.51% |
| 13 | 547089.99 | 103.62 | 2.54% |
| 14 | 423481.79 | 80.20 | 1.97% |
| 15 | 344489.48 | 65.24 | 1.60% |
| 16 | 406311.44 | 76.95 | 1.89% |
| 17 | 424330.35 | 80.37 | 1.97% |
| 18 | 641569.81 | 121.51 | 2.98% |
| 19 | 735446.82 | 139.29 | 3.42% |
| 20 | 408400.76 | 77.35 | 1.90% |
| 21 | 589133.47 | 111.58 | 2.74% |
| 22 | 256745.36 | 48.63 | 1.19% |
| 23 | 641993.49 | 121.59 | 2.98% |
| 24 | 466948.11 | 88.44 | 2.17% |
| 25 | 361496.49 | 68.47 | 1.68% |
| 26 | 317806.79 | 60.19 | 1.48% |
| 27 | 547926.69 | 103.77 | 2.55% |
| 28 | 474052.26 | 89.78 | 2.20% |
| 29 | 363815.99 | 68.90 | 1.69% |
| 30 | 333088.81 | 63.09 | 1.55% |
| 31 | 347433.71 | 65.80 | 1.61% |
| 32 | 463078.13 | 87.70 | 2.15% |
| 33 | 265877.43 | 50.36 | 1.24% |
| 34 | 634497.64 | 120.17 | 2.95% |
| 35 | 306321.07 | 58.02 | 1.42% |
| 36 | 580915.90 | 110.02 | 2.70% |
| 37 | 350384.22 | 66.36 | 1.63% |
| 38 | 483220.50 | 91.52 | 2.24% |
| 39 | 430503.69 | 81.53 | 2.00% |
| 40 | 328572.83 | 62.23 | 1.53% |
| 41 | 812461.39 | 153.88 | 3.77% |
| 42 | 294048.02 | 55.69 | 1.37% |
| 43 | 233469.28 | 44.22 | 1.08% |
| 44 | 201064.67 | 38.08 | 0.93% |
| 45 | 598401.70 | 113.33 | 2.78% |
| 46 | 150713.42 | 28.54 | 0.70% |
| 47 | 372284.88 | 70.51 | 1.73% |
| 48 | 154459.21 | 29.25 | 0.72% |
| 49 | 179128.45 | 33.93 | 0.83% |
| 50 | 344845.36 | 65.31 | 1.60% |
| total | 21526692.94 | 4,077.03 | 100.00% |
Wards 19 (south side) and 41 (Norwood Park, including O’Hare airport) have the highest portion of street length in the city.
Screenshot 2: Ward 41 is seen.
Street data dictionary
Column is “CLASS”. The value is a string. This dataset lacks alleys. Adapted from the City’s data dictionary.
1. Expressway
2. Arterials (1 mile grid, no diagonals)
3. Collectors (includes diagonals)
4. Other streets (side streets, neighborhood streets)
5. Named alleys (mostly downtown, like Couch Place and Garland Place)
7. Tiered (lower level streets, including LaSalle, Michigan, Columbus, and Wacker)
9. Ramps (goes along with expressway)
E. Extent (not sure how to describe these; includes riverwalk and lake walk segments, and Navy Pier, also includes some streets, like Mies van der Rohe Way)
RIV. River
S. Sidewalk
99. Unclassified
To develop the Chicago Bike Map app, I had a problem I thought would be simple to solve: load train lines into a Leaflet-powered map. I had the train lines stored as a polyline shapefile but Leaflet can only read the GeoJSON format or a string of geographic coordinates representing lines.
I eventually [...]
To develop the Chicago Bike Map app, I had a problem I thought would be simple to solve: load train lines into a Leaflet-powered map. I had the train lines stored as a polyline shapefile but Leaflet can only read the GeoJSON format or a string of geographic coordinates representing lines.
I eventually found a solution (I can’t remember how) and I need to share it with you. The converter can do more than ESRI shapefiles to GeoJSON. It can reproject the data in the conversion. It can convert from several formats to several other formats.
The site is called MyGeodata Converter. You upload a ZIP file of geographic files – .shp and its companion files (.prj, .dbf, .shx), .kml, and .gpx. Let’s take the Chicago Transit Authority train lines shapefile straight from the City of Chicago’s open data portal. It downloads as a zipped collection of a shapefile and its buddies and we can take this file straight to the Converter and upload it. The Converter will unzip it and read the data; it will even identify the projection system (for Chicago-based geographic data, its common to use NAD83 Illinois StatePlane East FIPS 1201 Feet (SRID 102671, the same as SRID 3435).
The Converter will convert to one of the following formats, with same or new projection; accepts SQL statements to extract a subset of data:
- ESRI shapefile
- GML
- KML, KMZ
- GeoJSON
- Microstation DGN
- MapInfo File
- GPX
- CSV
About Steven Can Plan
I started this blog in 2007 as the writing assignment for an introductory urban planning class at UIC. It's about cities (mainly Chicago), GIS oftentimes, and transportation (mainly bicycling). Learn more about me, Steven Vance. I also write for Streetsblog Chicago.
Steven Can Plan is hosted on Dreamhost.
Chicago Bike Map App

The Chicago Bike Map app is a bike and street map stored entirely in your iOS device – no data connection required. The map is designed to look much like the City of Chicago's official printed and online bike map. The app works on iPhone, iPod touch, and iPad.
- Download from the iTunes Store
- Demo the app online
- On iOS, search for "chicago bike map" in the App Store app
Highly Recommended Bike Products

Detours Toocan utility pannier
I've used this pannier to carry groceries, books, my laptop, clothing, anything. I like it because it's stylish (but also "normal" looking at the same time), stands up on its own, is extremely durable, and has the most universal attachment system: two hooks.

Brooks B67 leather sprung saddle
So far my longest trip was 40 miles on this saddle. It molds to your butt like Birkenstock sandals mold to your feet. The springs make the bike ride a little more comfortable and more fun (weird, because you bounce up and down on them). It also looks gorgeous. Comes in 3 colors - I got black.

So far I haven't had a flat with this tire. I've used Continental Gatorskin and Panaracer T-Serv, both of which have had flats (same Chicago streets). The Gatorskin has less tread than both, and wears to a slick surface faster.
Advertisement
Books

Instant City: Life and Death in Karachi by Steve Inskeep
I reviewed this book that the publisher sent to me.

The Practice of Local Government Planning (Municipal Management Series) by
You could basically design and administer a new town kind of effectively after reading this huge and boring textbook.

Making Maps: A Visual Guide to Map Design for GIS by John Krygier PhD, Denis Wood PhD
If you are going to make a map, whether it be hand drawn or digital, you should really give this book a read. Then read it every time you make a map. It will help make sure your maps are laid out sensibly, in a way that others can easily read, and that it doesn't include fluff or unnecessary data.

Joyride: Pedaling Toward A Healthier Planet by Mia Birk, With Joe (Metal Cowboy) Kurmaskie, Joe Kurmaskie, Jim Moore
I met Mia Birk in October 2011.
Transit & Transportation




