Tag: Divvy

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.

Bike lane mileage is the wrong metric for your city to publicize

Sometimes I tweet things that get pretty popular and then I need to go into more details. Case in point:

Which I followed by tweeting:

Knowing how many miles of bike lanes you have has little importance in determining if I’m going to bike in your city when I visit, or if I’m considering moving there, or if I want to add you to a “bicycle friendly cities” list.

What’s more important is how much the number of people bicycling on those bike lanes has changed. This number will reflect the quality of your bike lanes. Are they still in good shape or have they faded a lot? Do they connect to each other to create a network, or are there gaps that increase the stress of a route? How have you treated the bike lane at intersections, the place where a conflict and crash is most likely to occur?

Chicago Tribune architecture critic Blair Kamin touched on these points in his recent critique, one of the few worthwhile articles the Tribune has published in the last year about bicycling, by interviewing an organization that tries to make it politically palatable to build unconventional – in the United States – bike lanes.

“Chicago has made incredible progress over the last few years,” said Martha Roskowski, vice president at People for Bikes, a Boulder, Colo.-based advocacy group. But, she added, “Chicago also has a ways to go.”

That’s saying it nicely.

Addressing the gaps in the city’s network of protected bike routes, Roskowski said: “People evaluate a potential bike ride on the basis of the weakest link, the scariest part of the trip, which might be a really busy road you have to ride along or across. People have tolerance for a little bit of that. But if it’s sustained or if it feels dangerous, they just won’t do it.”

Enter Close Calls, deteriorating bike lanes, bumpy pavement, and constant obstacles and you get Chicago’s ridiculously low bicycle commute to work numbers.

Since Emanuel took office in 2011, Chicago has installed 52 miles of protected bike lanes [it’s only installed 16 miles of protected bike lanes], which use a variety of means — plastic pylons, striped pavement markings and non-curbside parking spaces — to separate bikes from vehicles. That brings the city’s total bicycle lanes to 207 miles.

That’s cool that we have 207 miles. How many miles of streets without bike lanes do we have? It’s 4,000 and some change minus 207.

Why doesn’t Mayor Rahm Emanuel talk about how many people have taken up bicycling since he took office, or how many more trips Chicagoans made (and where) because of those 52 miles of new buffered and protected bike lanes?

He can’t say how many people are riding their personal bikes because the city doesn’t track this.

Conversely we can track Divvy bike-share use down to the minute and the company announced that Saturday, May 24, they had their most trips ever. Only to be eclipsed by almost 4,000 more trips on Sunday, May 25 (helped in no small part by the Bike The Drive event where people can bicycle on a Lake Shore Drive that’s closed to vehicles).

In another blow to good data for Chicago, Divvy will only be releasing trip data twice a year, while Citibike in New York City will be publishing it monthly, an improvement of Capital Bikeshare’s quarterly data releases.

If you’re not tracking who’s using your infrastructure, will you be able to know if the people you set out to attract have come out?

Divvy activity in Wicker Park-Bucktown

Divvy Bikes Outside Smoke Daddy

The Divvy bike-share station outside Smoke Daddy on Division Street at Wood Street is the fourth most popular in the Wicker Park & Bucktown neighborhoods. Photo by Daniel Rangel.

This is an analysis of the station use for Divvy bike-share stations in the Wicker Park and Bucktown neighborhoods (they blend together and it’s hard to know if the club or bar you’re going to is one neighborhood or the other).

Numbers represent a discrete trip, from one station to another (or the same station if the trip was greater than 3 minutes, to eliminate “hiccups” where the bike left the dock but didn’t actually go anywhere). Customer means someone who used a 24-hour pass and subscribers are annual members. Gender is self-reported on a member’s DivvyBikes.com user profile.

17 stations listed.

[table id=10 /]

This map of Wicker Park Divvy stations shows a residential service gap among the Damen/Cortland, Ashland/Armitage ( Metra) and North/Wood stations.

This map of Wicker Park Divvy stations shows a residential service gap among the Damen/Cortland, Ashland/Armitage (
Metra) and North/Wood stations.

Based on the popularity of the Ashland/Armitage station, which is right outside the Clybourn Metra station – a very popular train stop – I think there might be a residential service gap near Saint Mary of the Angels School. I recommend a Divvy station at Walsh Park this year because the Bloomingdale Trail will open and terminate there.

Notes

Not all of these stations were online when Divvy launched on June 28, 2013, but I haven’t yet looked into the history to see when each went online. Therefore direct comparisons are not appropriate until you have a trips per day number. Then, seasonality (very cold weather) has its own effect. At the very least, all stations were online by October 29th, with the final addition of the Lincoln Ave & Fullerton Ave (at Halsted) station.

Can someone use “R” to make a time series chart on the entire trips dataset so we can find the best cutoff time to eliminate “hiccups”?

Query used: SELECT count(`trip_id`), usertype, gender FROM `divvy_trips_distances` WHERE (start_station = ‘Claremont Ave & Hirsch St’ or end_station = ‘Claremont Ave & Hirsch St’) AND seconds > 180 GROUP BY `usertype`, gender

Where do Divvy riders go?

Divvys

Divvy bikes fit people of almost all sizes. Photo by Mike Travis (mikeybrick).

Divvy released the 2013 trip data on Tuesday for their data challenge, and presented alongside me the data, basic system operations info, and existing visualizations and apps, at a Divvy data-focused Open Gov Hack Night I put together at the weekly meeting. Thank you Chris Whitaker at Smart Chicago Collaborative for writing the meeting recap.

I “ran the numbers” on some selected slices of the data to post on Twitter and they range from the useless to useful! I’m using the hashtag #DivvyData.

  • Average trip distance of members in 2013 is estimated to be slightly shorter than casuals: 1.81 miles versus 1.56 miles – tweet
  • Bike 321 has traveled the furthest: 989 miles. Beat the next bike by 0.2 miles – tweet
  • Women members on average took longer trips (but fewer trips overall) on @DivvyBikes than men in 2013. – tweet
  • The average trip distance of 759,788 trips (by members and casuals) in 2013 is an estimated 1.68 miles. – tweet
  • In 2013, 79.05% of member trips were by men and 20.95% by women. – tweet
  • On average in 2013, 24-hour pass holders (whom I call casuals) made trips 2.5x longer (time wise) than members. – tweet
  • Damen/Pierce Divvy station (outside the Damen Blue Line station) is most popular in Wicker Park-Bucktown – data

And other stats, presented as embedded tweets:

 

 

Developing a method to score Divvy station connectivity

A Divvy station at Halsted/Roscoe in Boystown, covered in snow after the system was shutdown for the first time to protect workers and members. Photo by Adam Herstein.

In researching for a new Streetsblog Chicago article I’m writing about Divvy, Chicago’s bike-share system, I wanted to know which stations (really, neighborhoods) had the best connectivity. They are nodes in a network and the bike-share network’s quality is based on how well (a measure of time) and how many ways one can move from node to node.

I read Institute for Transportation Development Policy’s (ITDP) report “The Bike-Share Planning Guide” [PDF] says that one station every 300 meters (984 feet) “should be the basis to ensure mostly uniform coverage”. They also say there should be 10 to 16 stations per square kilometer of the coverage area, which has a more qualitative definition. It’s really up to the system designer, but the report says “the coverage area must be large enough to contain a significant set of users’ origins and destinations”. If you make it too small it won’t meaningfully connect places and “the system will have a lower chance of success because its convenience will be compromised”. (I was inspired to research this after reading coverage of the report in Next City by Nancy Scola.)

Since I don’t yet know the coverage area – I lack the city’s planning guide and geodata – I’ll use two datasets to see if Chicago meets the 300 meters/984 feet standard.

Dataset 1

The first dataset I created was a distance matrix in QGIS that measured the straight-line distance between each station and its eight nearest stations. This means I would cover a station in all directions, N, S, E, W, and NW, NE, SE, and SW. Download first dataset, distance matrix.

Each dataset offers multiple ways to gauge connectivity. The first dataset, using a straight-line distance method, gives me mean, standard deviation, maximum value, and minimum value. I sorted the dataset by mean. A station with the lowest mean has the greatest number of nearby stations; in other words, most of its nearby stations are closer to it than the next station in the list.

Sorting the first dataset by lowest mean gives these top five best-connected stations:

  1. Canal St & Monroe St, a block north of Union Station (191), mean of 903.96 feet among nearest 8 stations
  2. Clinton St & Madison St, outside Presidential Towers and across from Northwestern Train Station (77), 964.19 feet
  3. Canal St & Madison St, outside Northwestern Train Station (174), 972.40
  4. Canal St & Adams St, north side of Union Station’s Great Hall (192), 982.02
  5. State St & Randolph St, outside Walgreens and across from Block 37 (44), 1,04.19

The least-connected stations are:

  1. Prairie Ave & Garfield Blvd (204), where the nearest station is 4,521 feet away (straight-line distance), or 8.8x greater than the best-connected station, and the mean of the nearest 8 stations is 6,366.82 feet (straight-line distance)
  2. California Ave & 21st St (348), 6,255.32
  3. Kedzie Ave & Milwaukee Ave (260), 5,575.30
  4. Ellis Ave & 58th St (328), 5,198.72
  5. Shore Drive & 55th St (247), 5,168.26

Dataset 2

The second dataset I manipulated is based on Alex Soble’s DivvyBrags Chrome extension that uses a distance matrix created by Nick Bennett (here’s the file) that estimates the bicycle route distance between each station and every other station. This means 88,341 rows! Download second dataset, distance by bike – I loaded it into MySQL to use its maths function, but you could probably use python or R.

The two datasets had some overlap (in bold), but only when finding the stations with the lowest connectivity. In the second dataset, using the estimated bicycle route distance, ranking by the number of stations within 2.5 miles, or the distance one can bike in 30 minutes (the fee-free period) at 12 MPH average, the following are the top five best-connected stations:

  1. Ogden Ave & Chicago Ave, 133 stations within 2.5 miles
  2. Green St & Milwaukee Ave, 131
  3. Desplaines St & Kinzie St, 129
  4. (tied) Larrabee St & Kingsbury St and Carpenter St & Huron St, 128
  5. (tied) Clinton St & Lake St and Green St & Randolph St, 125

Notice that none of these stations overlap with the best-connected stations and none are downtown. And the least-connected stations (these stations have the fewest nearby stations) are:

  1. Shore Drive & 55th St, 11 stations within 2.5 miles
  2. (tied) Ellis Ave & 58th St and Lake Park Ave & 56th St, 12
  3. (tied) Kimbark Ave & 53rd St and Blackstone Ave & Hyde Park Blvd and Woodlawn Ave & 55th St, 13
  4. Prairie Ave & Garfield Blvd, 14
  5. Cottage Grove Ave & 51st St, 15

This, the second dataset, gives you a lot more options on devising a complex or weighted scoring system. For example, you could weight certain factors slightly higher than the number of stations accessible within 2.5 miles. Or you could multiply or divide some factors to obtain a different score.

I tried another method on the second dataset – ranking by average instead of nearby station quantity – and came up with a completely different “highest connectivity” list. Stations that appeared in the least-connected stations list showed up as having the lowest average distance from that station to every other station that was 2.5 miles or closer. Here’s that list:

  1. Kimbark Ave & 53rd St – 13 stations within 2.5 miles, 1,961.46 meters average distance to those 13 stations
    Blackstone Ave & Hyde Park Blvd – 13 stations, 2,009.31 meters average
    Woodlawn Ave & 55th St – 13 stations, 2,027.54 meters average
  2. Cottage Grove Ave & 51st St – 15 stations, 2,087.73 meters average
  3. State St & Kinzie St – 101 stations, 2,181.64 meters average
  4. Clark St & Randolph St – 111 stations, 2,195.10 meters average
  5. State St & Wacker Dr – 97 stations, 2,207.10 meters average

Back to 300 meters

The original question was to see if there’s a Divvy station every 300 meters (or 500 meters in outlying areas and areas of lower demand). Nope. Only 34 of 300 stations, 11.3%, have a nearby station no more than 300 meters away. 183 stations have a nearby station no further than 500 meters – 61.0%. (You can duplicate these findings by looking at the second dataset.)

Concluding thoughts

ITDP’s bike-share planning guide says that “residential population density is often used as a proxy to identify those places where there will be greater demand”. Job density and the cluster of amenities should also be used, but for the purposes of my analysis, residential density is an easy datum to grab.

It appears that stations in Woodlawn, Washington Park, and Hyde Park west of the Metra Electric line fare the worst in station connectivity. The 60637 ZIP code (representing those neighborhoods) contains half of the least-connected stations and has a residential density of 10,468.9 people per square mile while 60642, containing 3 of the 7 best-connected stations, has a residential density of 11,025.3 people per square mile. There’s a small difference in density but an enormous difference in station connectivity.

However, I haven’t looked at the number of stations per square mile (again, I don’t know the originally planned coverage area), nor the rise or drop in residential density in adjacent ZIP codes.

There are myriad other factors to consider, as well, including – according to ITDP’s report – current bike mode share, transit and bikeway networks, and major attractions. It recommends using these to create a “demand profile”.

Station density is important for user convenience, “to ensure users can bike and park anywhere” in the coverage area, and to increase market penetration (the number of people who will use the bike-share system). When Divvy and the Chicago Department of Transportation add 175 stations this year – some for infill and others to expand the coverage area – they should explore the areas around and between the stations that were ranked with the lowest connectivity to decrease the average distance to its nearby stations and to increase the number of stations within 2.5 miles (the 12 MPH average, 30-minute riding distance).

N.B. I was going to make a map, but I didn’t feel like spending more time combining the datasets (I needed to get the geographic data from one dataset to the other in order to create a symbolized map).