Category: Transportation

Use Turf to perform GIS functions in a web browser

Turf's merge function joins invisible buffers around each Divvy station into a single, super buffer.

Turf’s merge function joins invisible buffers around each Divvy station into a single, super buffer –all client-side, in your web browser.

I’m leading the development of a website for Slow Roll Chicago that shows the distribution of bike lane infrastructure in Chicago relative to key and specific demographics to demonstrate if the investment has been equitable.

We’re using GitHub to store code, publish meeting notes, and host discussions with the issues tracker. Communication is done almost entirely in GitHub issues. I chose GitHub over Slack and Google Groups because:

  1. All of our research and code should be public and open source so it’s clear how we made our assumptions and came to our conclusions (“show your work”).
  2. Using git, GitHub, and version control is a desirable skill and more people should learn it; this project will help people apply that skill.
  3. There are no emails involved. I deplore using email for group communication.*

The website focuses on using empirical research, maps, geographic analysis to tell the story of bike lane distribution and requires processing this data using GIS functions. Normally the data would be transformed in a desktop GIS software like QGIS and then converted to a format that can be used in Leaflet, an open source web mapping library.

Relying on desktop software, though, slows down development of new ways to slice and dice geographic data, which, in our map, includes bike lanes, wards, Census tracts, Divvy stations, and grocery stores (so far). One would have to generate a new dataset if our goals or needs changed .

I’ve built maps for images and the web that way enough in the past and I wanted to move away from that method for this project and we’re using Turf.js to replicate many GIS functions – but in the browser.

Yep, Turf makes it possible to merge, buffer, contain, calculate distance, transform, dissolve, and perform dozens of other functions all within the browser, “on the fly”, without any software.

After dilly-dallying in Turf for several weeks, our group started making progress this month. We have now pushed to our in-progress website a map with three features made possible by Turf:

  1. Buffer and dissolving buffers to show the Divvy station walk shed, the distance a reasonable person would walk from their home or office to check out a Divvy station. A buffer of 0.25 miles (two Chicago blocks) is created around each of the 300 Divvy stations, hidden from display, and then merged (dissolved in traditional GIS parlance) into a single buffer. The single buffer –called a “super buffer” in our source code – is used for another feature. Currently the projection is messed up and you see ellipsoid shapes instead of circles.
  2. Counting grocery stores in the Divvy station walk shed. We use the “feature collection” function to convert the super buffer into an object that the “within” function can use to compare to a GeoJSON object of grocery stores. This process is similar to the “select by location” function in GIS software. Right now this number is printed only to the console as we look for the best way to display stats like this to the user. A future version of the map could allow the user to change the 0.25 miles distance to an arbitrary distance they prefer.
  3. Find the nearest Divvy station from any place on the map. Using Turf’s “nearest” function and the Context Menu plugin for Leaflet, the user can right-click anywhere on the map and choose “Find nearby Divvy stations”. The “nearest” function compares the place where the user clicked against the GeoJSON object of Divvy stations to select the nearest one. The problem of locating 2+ nearby Divvy stations remains. The original issue asked to find the number of Divvy stations near the point; we’ll likely accomplish this by drawing an invisible, temporary buffer around the point and then using “within” to count the number of stations inside that buffer and then destroy the buffer.
Right-click the map and select "Find nearby Divvy stations" and Turf will locate the nearest Divvy station.

Right-click the map and select “Find nearby Divvy stations” and Turf will locate the nearest Divvy station.

* I send one email to new people who join us at Open Gov Hack Night on Tuesdays at the Mart to send them a link to our GitHub repository, and to invite them to a Dropbox folder to share large files for those who don’t learn to use git for file management.

Streetsblog Chicago deserves to come back

John and Steven dining at a restaurant table

John and I at Taqueria La Zacatecana in Avondale, where we first hashed out the details of what would become Grid Chicago that later transitioned into Streetsblog Chicago.

I haven’t talked about this here, but two months ago this weekend I got the message that Streetsblog Chicago wouldn’t continue because we didn’t raise enough money in the last fundraising round.

I didn’t talk about it here because I was busy with dealing with shutting that down, working with my partner John Greenfield to come up with a transition plan (to resurrect the site) and because I have myriad side projects that quickly and easily captured my newly-available attention. I eased right into developing those more and into involving myself in new jobs on a freelance basis.

Our readers dutifully expressed their support for my and John’s work at Streetsblog Chicago – providing an alternative voice for transportation and land use policy discussion.

The most heartening and unexpected expressions have come from the very agencies on which we report and criticize.

Our reporting was thoughtful and necessary they said, even though, and this has been unanimous, they sometimes disagreed with our perspective.

I believe their appreciation of our work has always been there but there was never a good moment, or a necessity, for them to make it known.

It’s heartening to know that our writing – advocating for safer streets, funding allocation that promoted efficient and active transportation, converting street space from moving cars quickly to moving people – was making its way in the corridors of the bureaucracies and street managers and place makers and bus operators.

I think what we did with Streetsblog Chicago was necessary, too, and I waited and worked to make it happen since 2007. I bided my time with this blog until meeting editor-in-chief Ben Fried in 2010. The conditions weren’t right then, and a friend at a 2011 Star Trek watching party (don’t ask) in Logan Square put me and John together after which we made the next best thing: Grid Chicago.

I want to keep writing Streetsblog Chicago and we need your help. John and I are raising $75,000 to resume publishing at very-close-to-before rate of five to seven original posts per week. Donate now.

We’ve already raised $36,905 and the Chicago Community Trust will give us $25,000 when we reach $50,000. The catch is that we must get there by April 8. Otherwise we’ll return all of the donations.

Since the January 8 hiatus we held a fundraiser in the pedway, which Moxie founder Daniel Ronan organized. We’ll be holding another fundraiser in Revolution Brewing’s taproom on Kedzie on Wednesday, March 26, at our donor appreciation party: Everyone is welcome but those who donate $100 on or before the party will get John’s book “Bars Across America” and their first round on the house.

I’m also putting together a tour of developments around Chicago near transit stations that have taken advantage of a city ordinance reducing their parking minimum. Save the date, Saturday, April 4.

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.

Meet Chicago’s newest street view fleet: bikes

Bicycle holds an iPhone to take street view-style images

This position gives the smartphone an unimpeded view of the street but prevents the user from manipulating it.

I first used the Mapillary app on iPhone last fall, in August, and I uploaded one photo, of my arm, which I can’t delete from the website. I uploaded a couple more photos from a street in Roscoe Village in November.

This week, though, I uploaded 500 photos from a three mile journey on California and Milwaukee Avenues in Chicago – streets that no one else had photographed for the Mapillary street view service.

Mapillary is an open source (sort of) street view service, originally developed in Sweden, which allows the public to contribute photos taken with their smartphone app.

What’s “sort of” about Mapillary being open source is that it appears that the company owns the photos once you upload them. People are free to use the photos to edit OpenStreetMap, or publish elsewhere – for personal use only – with attribution that adheres to Creative Commons 4.0. People who want to use the photos in a commercial application must subscribe to a pay service.

Mounting an iPhone to a bicycle

I took the jump from contributing nothing to uploading a whole lot because I bought an iPhone mount for my bicycle. After months of research – okay, chalk it up to my being lazy and it being really cold outside – I settled on the DgRock Universal Bicycle Mount from Amazon for $9. I was perplexed that there was a gap in choices between this decent $9 product and the next group, hovering around $30-40.

After three days of use, I’m satisfied, despite limitations that are present in all mounts I surveyed. The DgRock mount is solid, barely moves even as the bike bounces along Chicago’s pothole-ridden streets, and securely holds the iPhone with a strong, spring-loaded grip. It’s universal in two ways: it holds nearly any smartphone (it probably can’t hold one with a screen 5″ or larger) and it attaches to most bicycle handlebars.

The first day I used the DgRock mount Mapillary complained with a red icon that it couldn’t get a proper fix on its location and therefore it wouldn’t start photographing. Fine, I was in downtown Chicago where connecting to GPS satellites can be hard. I figured the wifi positioning system that all smartphones and tablets use would suffice.

There are problems with the mount, but I think these apply to all bicycle smartphone mounts: When the phone is in position to take photos, meaning its horizontal and level to the ground, you can’t see the screen. That’s because the screen, mounted on the handlebars, is much lower than your eyes and faces vertically, instead of angled towards your face. The only way around this, I believe, is to either get an upright bicycle (like my WorkCycles Fr8) or an adjustable lens (I can’t find any).

Smartphone mount holding an iPhone on a bicycle

This position allows the user to manipulate the smartphone but you cannot take street view-style images.

The possible position angles of the smartphone when held by the mount was my main concern as I was shopping on Amazon: The mount need to have the flexibility to position the smartphone so its rear camera could be level with the ground. Smartphone mounts, though, are made to put the device in a position to be used and viewed frequently by the bicycle rider – it was unclear if many of the other smartphone mounts could accommodate the street view angles requirement.

The DgRock has no issue moving the iPhone into the right position, as you can see in the photos from my journey (or scroll to the end). Its issue, though, is that you have to put the smartphone in “backwards” so that the claw covers up part of the screen. I call it an issue but it doesn’t disturb the mount’s primary purpose when using Mapillary – the phone still has a clear view of the street.

Even with an upright bike like mine, though, it’s difficult to see the screen. I believe that Mapillary can actually design its app to help overcome this physical limitation.

Using Mapillary

The Mapillary app has improved greatly since the first version. It allows you to delete bad or undesired photos before uploading, and it has a simpler interface to go from opening the app to making your own street view. There are a couple changes I think would improve the user experience and lead to more contributions.

I would like to be able to turn off the screen while using Mapillary to save battery life. I think that the screen could fade to black and a small white dot or halo appears frequently to remind you that it’s working. I’d also like it to chime when iOS throws the “low storage” warning. Otherwise I may be riding along, thinking Mapillary is capturing the street, when iOS had actually run out of storage 10 minutes ago.

Study recommends designing bike paths for bikes, not for sharing

running and bicycling on the lakefront trail

Some parts of the Chicago Lakefront Trail have a 2-foot wide side path designed for pedestrians but the study reviewed very cases where bicyclists crashed with pedestrians. It’s unknown if this side path results in fewer crashes than the parts of the Lakefront Trail without it. Photo: Eric Allix Rogers

The Active Transportation Alliance posted a link on Facebook to a new study [PDF] in the Open BMJ from December 2014, a free peer-reviewed “version” of the British Medical Journal, and said it “conclusively shows separated space reduces crashes and the severity of injuries when crashes occur”.

The posting was in the context that bicyclists and pedestrians using the Lakefront Trail should have separate paths. I agree, but there’s a problem in how they stated the study’s support for separation.

I wouldn’t say that the study “conclusively” shows that bicyclists would fare better on paths without pedestrians. The study reviewed fewer than 700 crashes in two Canadian cities. Only 11% of those crashes occurred on multi-use trails and only 5.9% of the crashes were with a pedestrian or animal (the two were grouped) – this sample size is too low from which to draw that kind of conclusion.

The study didn’t report the association (correlation) between crash severity and pedestrians. The authors didn’t even recommend that bicyclists and pedestrians have separate paths, but instead wrote “These results suggest an urgent need to provide bike facilities…that are designed [emphasis added] specifically for bicycling rather than for sharing with pedestrians”.

While I don’t discount the possibility that separating bicyclists and pedestrians in off-street corridors will reduce the number of crashes and injuries when those two user groups collide, it’s imprudent to call this study “conclusive” when linking it to the measure of crashes between bicyclists and pedestrians.

The study’s primary conclusion was that bicyclists crash more often when there are high slopes, fast moving cars, or no bike lanes and the authors recommended that bike infrastructure be built for bicycling. That’s a solid recommendation and I recommended that you sign Active Trans’s petition advocating for separate facilities in the North Lake Shore Drive reconstruction project.