Temporal accessibility of workplaces by time of day

The release of the official nation-wide GTFS dataset for Germany has been a game changer for all kinds of public transport analysis recently. Within EMMA, we use a filtered version of this dataset for the region in OpenTripPlanner. The timetable-based accuracy of the data allows a very detailed look at the changes in accessibility over time due to variations in the public transport supply. We would like to illustrate this using TUM’s main campus in the center of Munich and the Garching Campus, which is north of the City, connected with a subway line.

TUM Stammgelänge in Maxvorstadt

The blue isochrones show the area from where you could reach the TUM campus within 30 minute with public transport at the given time of day (on a Wednesday). You can see some headway-related flickering during the day, but between the early morning until the late evening, the area is relatively stable. A dense network of multiple public transport lines, from buses, to trams, subways, and regional trains (“S-Bahn”) ensures a good accessibility of this location during most of the day. How does a similar map look for the example of Garching?

TUM Campus Garching-Hochbrück

As you might have expected, the isochrones are generally smaller, and much more narrow shaped along the North-South corridor. This is where the subway runs, the dominating public transport supply in the area. The effect of some bus lines is visible with the “islands” that appear on the map from time to time. Interestingly, there are some periods at night where there is no public transport on the campus at all.

How can we quantify and visualize these results?

The following graph shows the number of people who can reach the locations by time of day - again within 30 minutes of public transport (and a max. walk distance of 800m).

Comparison of both locations

The striking difference in absolute numbers is not unexpected, given the locations. Some observations beyond this:

  • The night shutdown from 2:00 - 5:00 is affecting Garching more than the main campus, where some supply is available 24/7.
  • You can identify (in the main campus mainly) the increased supply during the peak hours (roughly 7:00- 9:00 and 16:00 - 19:00)

What does this imply for workplace locations?

First, one has to understand that on the Garching Campus, there are mainly university buildings and other research institutions, but no housing at all. Thus, effects like the complete shutdown of public transport at night does not have a negative impact on this location at the moment. However, it does show that in the case of structural changes to the locations, adaptions will be necessary.
Within EMMA, we can repeat a similar analysis in more depth e.g. for workplace locations, where a 24/7 accessibility is important (such as hospitals, factories with night shifts, …) and generate recommendations for the further development.
Stay tuned!

How did we do this?

This analysis has been done in an R Script with roughly the following steps:

Create a new dataframe and add a row for each departure (or arrival) time you want in your analysis. This is easily done with the {DepartureTime} R package by Marcin Stępniak.

isochrones <- DepartureTime(
  method = "S",
  dy = 2020,
  dm = 7,
  dd = 15,
  tmin = 0,
  tmax = 24,
  res = params$res,
  ptw = FALSE

Then, we added the isochrone (generated by OpenTripPlanner) for the location of interest as a new column to the dataframe. We did this with a simple for-loop, which called a custom-made get_isochrone_sf function for each departure time we defined in the previous step. You could do this more easily with the help of Marcus Young’s otpr R package. The st_buffer(dist = 0) helps us to make sure the polygons pass all validity checks by buffering with zero distance.

isochrones <- isochrones %>% mutate(geometry = NA) #prepare empty column in df
# loop through departure times and calculate Isochrone for each
for (ID in (0:(nrow(isochrones)))) {
  iso <- get_isochrone_sf(params$lat, params$lng, "TRANSIT, WALK", params$date, isochrones$time[ID],
                          800, 1, TRUE, 30) %>% st_buffer(dist = 0)
  isochrones$geometry[ID] <- iso$geometry # save in column "geometry"

To make it an actual sf object and fix some other issues like the correct CRS, we used the following:

# Turn it into an sf object with the correct CRS info

isochrones <- isochrones %>%  st_sf() # make sf object
isochrones <- isochrones %>% st_cast("MULTIPOLYGON") # cast as multipolygon
isochrones <- isochrones %>% st_set_crs(4326) # set CRS

isochrones <- isochrones %>% mutate(area = st_area(st_transform(geometry, 3857)))

The final step is to create a map and animate it. In this example, we use a combination of ggmap, which is based on ggplot2,for the mapping and gganimate for the animation.

# Map and animate

bbox <- c(11.413111,48.05974,11.718668,48.223315) # define base map extent
muc_basemap <- get_stamenmap(c(bbox[1], bbox[2], bbox[3], bbox[4]), zoom = 13, maptype = "toner-lite") #get basemap

anim <- ggmap(muc_basemap) +
  coord_sf(crs = st_crs(3857)) + # force the ggplot2 map to be in EPSG 3857
  geom_sf(data = isochrones, inherit.aes = FALSE, fill = "#0065BD", alpha = .5) + #add isochrones
  geom_point(aes(x = 11.5681012114146 , y = 48.1500453494002), size = 4, # add point for TUM location
             shape = 21, fill = "#0065BD") +
  labs(title = "TUM Main Campus: PT Accessibility at {current_frame} on a weekday",
       subtitle = "30-min public transport isochrone with a max. walking distance of 800m") +
  transition_manual(time) # this is where the animation magic happens

To export the animation, either just save the Viewer() manually or use the export function as mp4 or gif.

# high quality
animate(anim, fps = 4, height = 1200, width = 1400, res = 230)

#low quality for testing
animate(anim, fps = 4, height = 400, width = 600, res = 100)

# save as MP4 for linkedin
b <- animate(anim, duration = 14, height = 2800, width = 3200, res = 600, renderer = av_renderer())
anim_save("output2.mp4", b)

Maximilian Pfertner
Maximilian Pfertner
Researcher & PhD Candidate

EMMA’s main researcher.