## Recursive grids for density measures

I’ve been wanting to do this for ages… and I finally did!

The idea is this:

1. Create a square.
2. If the square has more than n things inside it, divide it into four parts.
3. Do the same for each of those squares and so on recursively.

My recent pet project1, cul-de-sacs (threshold = 10 or less per):

Dayton got a bit cut off, unfortunately. Trust me though: it has plenty of sprawl! This image sort of gives you an idea how the process works.

Population density, based on 2010 census blocks (threshold = 100 people or less per):

14 levels deep! This one took a couple hours. Click through for a larger image.

Many more to come, I’m sure, now that I’ve written the script…

Show 1 footnote

1. I love the idea of a density measure of sprawl!
Posted in: Data | Maps | Silly Bullshit
Tags: | | |

## GIF Mapping Differential Passenger Flows: preliminary results

I read a clever little article while I was researching R graphics for this project. It started out with a whole paragraph just making the point that no one would read the paragraph itself first. Instead, our eyes would all flash down to the brightly colored graphic right below. Mine certainly did. Did yours? I could write pretty much anything here, but you won’t read it until you’ve satisfied yourself with the silly flashy GIF:

But since we’re not interested in psychology(see above, if you haven’t), some description is perhaps in order: blue is a balance in favour of people boarding buses, red of people getting off the buses. Circle area equals the absolute difference between boardings and alightings at each scheduled stop. This means among other things that stops with balanced passenger boardings and alightings will not show up at all1. Each time-step is a half-hour period.

The idea here is simply to show the temporal unbalance of passenger flow in the transit system: at some times of day, more people are going in one direction than in the other. This is why you occasionally hear the complaint that “buses are running empty” and implicitly that no one is using the system or that parts of it could bear trimming. The routes are not usually inefficient so much as the passengers are, with their chaotic plans and schedules, failing to neatly balance themselves and set each other off as more orderly citizens might do.

Notice how the overall color of the outlying stops changes at the rush hours from blue (boarding) in the morning to red (alighting) in the evening, the reverse for downtown and most of uptown. Clearly, the overall pattern we’re seeing is that a lot of commuters are coming in from the outer neighborhoods for daytime work in the central ones.

As the title says though, these are preliminary results. I made the circles transparent so colors can blend and become more opaque where activity is more intense, but there’s still a tremendous amount that’s obscured in this map. The next step is to change it from a map of mutually interfering circles into something clearer at the busy confluences of multiple lines. I’m thinking, and if you’ve been following this blog lately it should be on the tip of your tongue already, of creating a kernel density surface to properly deal with the busy areas.

In the meantime, I’ll attempt to assuage your hungry eyes with a couple more GIFs.

My first attempt at a GIF, using a much less automated method2, shows this same basic pattern, but in the context of Cincinnati neighborhoods.

Another one breaks it down a further than the first one I showed, dropping the time-interval to two minutes rather a half-hour. Again, blue is a balance in favour of boardings, red in favour of alightings.

This one is particularly interesting, I think, because you can really start to see individual buses flashing through the city. I love the finale, right around 25:10 (1:10AM) where the buses all explode out of government square on their last run at around the same time to deposit their passengers in an adorably pathetic little fizzle of red from blue.

Anyhoo, I’ll say yet again, this is preliminary and I share it now because I think this data is tremendously exciting. We’ll see what I can make of it in the next few days!

Show 2 footnotes

1. Two people get on, two people get off. Four people used the stop, but I won’t show you any of them here.
2. I clipped the data and exported 24 maps one at a time from QGIS.
Posted in: Data | Maps | Method
Tags: | | | | | | | |

## Transit Stop Dispersion

This is a histogram showing the distance from every stop on every line in each direction to it’s nearest neighbor on the same line in the same direction. That’s the complicated way of saying: How far is every bus stop from it’s nearest neighbor?

Some basic stats:
Minimum = 56 feet
Maximum = 66,125 feet (12.52 miles)
Mean = 589 feet
Median = 476 feet

That massive 12-mile outlier is the 82X, which seems to have only one stop at it’s terminus in Eastgate after picking people up downtown. The next largest value is 8,484 feet for a pair of stops on the 30X.

I think it would be interesting to see how this distribution compares to TANK and some agencies in other cities…though that analysis will have to wait until after exam week. Unless anyone cares to get a head start on me! It wouldn’t be hard to do using GTFS data and the following code.

POSTGIS SQL code:

``````-- how far away is the nearest stop in this line and direction?
WITH stop_matrix AS (
SELECT
a.line,
a.stop_id AS s1,
b.stop_id AS s2,
a.direction,
a.the_geom <-> b.the_geom AS dist -- geometry unit is feet(EPSG:3735)
FROM
stops_table AS a,
stops_table AS b
WHERE a.line = b.line AND a.direction = b.direction ),
SELECT
s1,
line,
direction,
MIN(dist) AS mindist
FROM stop_matrix
WHERE s1 != s2 -- or else we'll get zeros
GROUP BY s1, line, direction ;  -- aggregate at the level of stops``````