Main Street. Will people bike there? An addendum.

Python, SQL, QGIS, and ValleyBike trip data reveal the average cyclist’s range—or at least a useful estimate.


One in a series of projects highlighting my progress as a self-taught programmer.

I began teaching myself Python, SQL, and GIS in spring 2023 — starting from zero. I therefore welcome feedback on these projects and review for errors. And I’d be interested in taking a crack at your own data and geospatial questions too. Please get in touch.


22 September 2023

Background

My previous post used data from a regional bike share network to test an argument oft-repeated in my local newspaper: That bike lanes should not be part of any Northampton, Mass., Main Street redesign because Main Street is too far away for most residents to access by bike. (e.g. “[City leaders should] not prioritize a nice perk for the select few who are lucky to live close enough to bike at the expense of the vast majority.” Source.)

My analysis of 200,000+ trips taken on the ValleyBike system found, however, that:

  1. The network’s Main Street area docking stations ranked among the most popular in Northampton and the broader region—i.e., there is great interest in accessing Main Street by bike;

  2. Trips departing from or leaving Main Street area stations averaged about 20 minutes in duration;

  3. An estimated 30,000 people (roughly equivalent to Northampton’s population) live within a 20-minute bike ride of Main Street, a catchment area that also includes 84 percent of the city’s structures.

The data, it seemed to me, demonstrated Main Street was a popular biking destination well within reach of much of Northampton—that new Main Street bike lanes would hardly be just “a nice perk for the select few.”

But, as one reader pointed out, I did not consider that ValleyBike exclusively rents electric-assist bicycles, “e-bikes” that require pedaling but which can also provide low-power motorized support. Does this fact undermine my findings and conclusions?

To investigate, I considered the data again—code and databases dutifully saved on my hard drive—approaching the question two ways:

  • Doubling-down on the e-bike lens;

  • Attempting another comparison of e-bike usage with conventional bike (and car) use, again emphasizing time, not distance.

(n.b. My previous post explains how and why, for most analyses, I limited my ValleyBike trip dataset, which spanned January 2021 to October 2022, to non-loop rides between 2 and 45 minutes in duration. I considered the “Main Street area” ValleyBike docking stations to be Northampton Train Station, Pulaski Park/Downtown, Main Street/Court House, and Main Street/Bridge Street.)

Project outputs

Maintaining an e-bike lens on ValleyBike data does nothing to refute Main Street’s popularity and accessibility as a biking destination. If bike lane skeptics contend some people “live too far from downtown for a round-trip bike ride” or “don’t have the time for a bike trip” (source), ValleyBike trip data reveals almost the exact opposite to be true for at least one cycling segment.

The OpenRouteService isochrone tool I used to map ranges in QGIS includes an e-bike estimator in addition to the more conservative option I originally employed above. If we map the 20-minute e-bike cycling catchment around the four Main Street area ValleyBike stations, we find even more of Northampton within an average ride of downtown:

E-bikers’ revealed comfort with 20-minute rides implies that 94 percent of Northampton’s 12,737 structures are within reasonable e-biking range of Main Street. The catchment, ORS estimates, spans over 41,000 people, a figure equivalent to 140 percent of Northampton’s population (which is possible because the catchment extends beyond the city).

Below I attempt again to translate ValleyBike patterns to conventional wheels, but, first, there are many reasons e-bike data should be honored on its own. One, the public bike share network uses e-bikes! (ValleyBike is actually on pause while the City of Northampton searches for a new vendor/operator.) Digging deeper here, I wrote a Python script to plot a histogram of all non-loop ValleyBike trips between 2 and 45 minutes long that involved one of the four Main Street area stations (which, in further evidence of bikers’ interest in accessing Main Street, accounted for nearly 20 percent of all non-loop, 2-45-minute rides systemwide):

While the average trip duration was approximately 20 minutes, the slightly lower median indicates half of all trips were under 18 minutes, with several high-frequency “bins” under 10—all implying some Main Street-centric riding (and/or problematic data points. I discarded rides shorter than two minutes, even though three-minute sprints seemed questionable too. But I worried a higher floor might artificially raise the average trip duration. I prefer my isochrones conservative.)

Most popular ValleyBike routes with a Main Street area start- or end-point (Routes that would benefit from Main Street bike lanes are in bold/italics)

  1. State St/Mass Central Rail Trail -> Northampton Train Station

  2. Northampton Train Station -> State St/Mass Central Rail Trail

  3. Northampton High School -> Main Street/Bridge Street

  4. Northampton Train Station -> Rail Trail @ Millside Park

  5. Rail Trail @ Millside Park -> Northampton Train Station

  6. Northampton Train Station -> Florence Center

  7. Northampton Train Station -> Pulaski Park/Downtown

  8. Florence Center -> Northampton Train Station

  9. Pulaski Park/Downtown -> Village Hill/State Hospital

  10. Pulaski Park/Downtown -> Northampton Train Station

  11. Village Hill/State Hospital -> Pulaski Park/Downtown

  12. State St/Mass Central Rail Trail -> Pulaski Park/Downtown

  13. Northampton Train Station -> Rail Trail @ Union Street

  14. Northampton High School -> Pulaski Park/Downtown

  15. Main Street/Bridge Street -> Northampton High School

When I queried with SQL for the most popular trip routes that started or ended at the Main Street stations—there were 268 such possible start- and end-station combinations in the dataset—I noticed that 5 of the top 15 would be best navigated using Main Street. That is, for those trips, based on my experience as a rider, Main Street bike lanes would likely offer safer and/or more direct passage. (See list at right. Yeah, yeah, Pulaski-to-Train Station can be done by rail trail, but I’d take Main Street, at least in part, over dealing with the drop behind Pulaski.)

In short, public bike share users are riding to, through, and from Main Street—a point in favor of public investment in Main Street bike lanes.

Another reason not to ignore ValleyBike data through a purely e-bike lens is e-bikes’ growing popularity. Though expensive (relative to conventional bikes, not cars), e-bikes may represent the fastest growing segment of bicycle sales, recently showing 75 to 132 percent growth in annual sales (source, source). They are cargo-friendly, don’t take up parking spaces, and perhaps more important than extending rider range, expand the range of populations who can board two wheels. And ValleyBike data, as presented here, counsels accommodating this market.

So that is the standalone e-bike data argument. If ValleyBike data can only tell us about ValleyBikes and e-bikes, the data nonetheless implies a ridership that demands Main Street access and an increasingly popular transportation mode that situates Main Street “close enough to bike” for nearly all of Northampton.

But let’s try again to deduce a more general cycling range.

My method in this project has been to focus on cycling time, not distance. (Our destination may be x miles away as the crow flies, but routing, terrain, and more guarantee we’ll ride/drive/walk further than x miles to get there.) And in ValleyBike we have a dataset that reveals how much time in the saddle an average rider will tolerate in order to reach Main Street. Surely we can infer some kind of time-based range for cyclists generally?

How about 15 minutes? Even though a six-year-old I know rode a small-wheeled bike well over 20 minutes and some 4 miles last weekend—twice—let us lower expectations and assume that even if the average e-bike rider will pedal for 20 minutes (and, about half the time, longer), no conventional bike rider at all spins for more than 15 minutes. A 25 percent discount. Does such circumscribing deprive most of Northampton of the benefits of Main Street bike lanes?

The above 15-minute cycling isochrone spans roughly two out of every three structures in the city and an estimated minimum of 25,400 people (equivalent to 87 percent of Northampton’s population). These calculations still imply that much more than a “select few” residents could reasonably make use of bike lanes on Main Street.

As alluded to, I often wonder if “distance” is deceiving when considering what lies within a reasonable (average) bike ride—which is why we can learn much from the duration of ValleyBike trips. One letter to the local paper suggested “over 2 miles from the center of town” was an unlikely distance for certain bike trips. But a two-mile ring around Main Street looks a lot like…

… the isochrones for 10-minute conventional- and e-bike trips. That 10-minute conventional bike catchment snags an estimated 18,800 people and 45 percent of Northampton’s structures; the two-mile ring encompasses 49 percent of structures in the city. We are still talking large portions, not small fractions, of town.

Here is another example I found instructive when thinking about time instead of distance. When mapping driving ranges, I noticed that a 10-minute drive from the parking lots behind Thornes Marketplace can get you a ways up and down I-91 and into Easthampton, but when it comes to Northampton proper, the isochrone is really not much different than a 15-minute bike trip, e-bike or conventional—and the driving clock doesn’t include walking to/from the actual desired destination or time spent paying for parking.

The point is, to answer our original question, the idea that Main Street is beyond the general cycling range of the majority of Northampton residents simply does not appear to be true—and ValleyBike data helps us see that.

Counterpoints

This addendum was inspired by a reader’s concern that my original post did not acknowledge ValleyBike was an e-bike operation. While I hope to have engaged that point here, I can think of several other reasons this analysis may not be watertight. Among them:

  • ValleyBike trip data is skewed because the location of docking stations dictates where one can ride to/from and how long it will take (i.e. of course Main Street is a popular destination and of course trip durations fall in a certain range because that is how the station network is set up). This is undoubtedly true, but the ValleyBike database nonetheless provides a sense of the length of time riders are willing to pedal. Further, the distances between stations are quite diverse—from Pulaski Park one can pedal a block or two to a Smith College station, or all the way to Easthampton or Amherst, or something in-between, like the YMCA or Florence.

  • Are those isochrones accurate? I’ve spot checked them and compared OpenRouteService’s results with other services, and I remain generally convinced they give a decent indication of reach and catchment population. There’s some documentation here and here.

  • Perhaps much of Northampton indeed falls within a 15-minute ride of Main Street, but beyond the bike trails and lanes, many of the streets are downright dangerous to cycle, especially for less experienced riders (due to bad drivers, narrow roads, maintenance issues, etc.). To the extent this is true, more and better bike lanes would be a solution—and Main Street is a great place to start.

Techniques

I used the same tools as in my previous post, including SQL queries, Python scripts (with pandas, matplotlib and seaborn libraries), and GIS tools like spatial joins and dissolves, and of course the Open Route Service API for isochrones.

Data sources

Again, as before—and copying-and-pasting from my previous post—I downloaded and processed ValleyBike trip data from a City of Northampton site, which was linked from a separate City of Northampton ValleyBike page. The Amherst-Statistics GitHub page and a ValleyBike annual report got me started with station addresses, and bike path shapefiles came from MassGIS. Other sources included:

Previous
Previous

Funny distributions: Professional soccer player size, footedness, and birthdays

Next
Next

Main Street. Will people bike there?