12.4 Desire lines
12.4 Desire lines
Unlike zones, which represent trip origins and destinations, desire lines connect the centroid of the origin and the destination zone, and thereby represent where people desire to go between zones.They represent the quickest ‘bee line’ or ’crow flies‘ route between A and B that would be taken, if it were not for obstacles such as buildings and windy roads getting in the way (we will see how to convert desire lines into routes in the next section).
We have already loaded data representing desire lines in the dataset bristol_od.This origin-destination (OD) data frame object represents the number of people traveling between the zone represented in o and d, as illustrated in Table 12.1.To arrange the OD data by all trips and then filter-out only the top 5, type (please refer to Chapter 3 for a detailed description of non-spatial attribute operations):
od_top5 = bristol_od %>%
arrange(desc(all)) %>%
top_n(5, wt = all)
``` Table 12.1: Sample of the origin-destination data stored in the data frame object `bristol_od`. These represent the top 5 most common desire lines between zones in the study area.o| d| all| bicycle| foot| car_driver| train
---|---|---|---|---|---|---
E02003043| E02003043| 1493| 66| 1296| 64| 8
E02003047| E02003043| 1300| 287| 751| 148| 8
E02003031| E02003043| 1221| 305| 600| 176| 7
E02003037| E02003043| 1186| 88| 908| 110| 3
E02003034| E02003043| 1177| 281| 711| 100| 7
The resulting table provides a snapshot of Bristolian travel patterns in terms of commuting (travel to work).It demonstrates that walking is the most popular mode of transport among the top 5 origin-destination pairs, that zone `E02003043` is a popular destination (Bristol city center, the destination of all the top 5 OD pairs), and that the _intrazonal_ trips, from one part of zone `E02003043` to another (first row of Table [12.1](https://geocompr.robinlovelace.net/transport.html#tab:od)), constitute the most traveled OD pair in the dataset.But from a policy perspective, the raw data presented in Table [12.1](https://geocompr.robinlovelace.net/transport.html#tab:od) is of limited use:aside from the fact that it contains only a tiny portion of the 2,910 OD pairs, it tells us little about _where_ policy measures are needed, or _what proportion_ of trips are made by walking and cycling.The following command calculates the percentage of each desire line that is made by these active modes:
bristol_od$Active = (bristol_od$bicycle + bristol_od$foot) / bristol_od$all * 100
There are two main types of OD pair:_interzonal_ and _intrazonal_.Interzonal OD pairs represent travel between zones in which the destination is different from the origin.Intrazonal OD pairs represent travel within the same zone (see the top row of Table [12.1](https://geocompr.robinlovelace.net/transport.html#tab:od)).The following code chunk splits `od_bristol` into these two types:
od_intra = filter(bristol_od, o == d) od_inter = filter(bristol_od, o != d)
The next step is to convert the interzonal OD pairs into an `sf` object representing desire lines that can be plotted on a map with the **stplanr** function `od2line()`.71
desire_lines = od2line(od_inter, zones_od)
An illustration of the results is presented in Figure [12.3](https://geocompr.robinlovelace.net/transport.html#fig:desire), a simplified version of which is created with the following command (see the code in `12-desire.R` to reproduce the figure exactly and Chapter [8](https://geocompr.robinlovelace.net/adv-map.html#adv-map) for details on visualization with **tmap**):
qtm(desire_lines, lines.lwd = "all") ```
Figure 12.3: Desire lines representing trip patterns in Bristol, with width representing number of trips and color representing the percentage of trips made by active modes (walking and cycling). The four black lines represent the interzonal OD pairs in Table 7.1.
The map shows that the city center dominates transport patterns in the region, suggesting policies should be prioritized there, although a number of peripheral sub-centers can also be seen.Next it would be interesting to have a look at the distribution of interzonal modes, e.g. between which zones is cycling the least or the most common means of transport.
