GeoVisual Analysis: Social Areas and Traffic Bottleneck
In this take-home exercise, we have two main tasks: 1) characterize the district areas with distinct features; 2) identify the busiest areas and traffic bottlenecks
packages = c('sf','tmap','tidyverse','lubridate',
'clock', 'sftime', 'rmarkdown')
for (p in packages){
if(!require(p, character.only = T)){
install.packages(p)
}
library(p,character.only = T)
}
schools <- read_sf("data/wkt/Schools.csv",
options = "GEOM_POSSIBLE_NAMES=location")
Pubs <- read_sf("data/wkt/Pubs.csv",
options = "GEOM_POSSIBLE_NAMES=location")
Apartments <- read_sf("data/wkt/Apartments.csv",
options = "GEOM_POSSIBLE_NAMES=location")
Buildings <- read_sf("data/wkt/Buildings.csv",
options = "GEOM_POSSIBLE_NAMES=location")
Employers <- read_sf("data/wkt/Employers.csv",
options = "GEOM_POSSIBLE_NAMES=location")
Restaurants <- read_sf("data/wkt/Restaurants.csv",
options = "GEOM_POSSIBLE_NAMES=location")
tmap_mode("plot")
tm_shape(Buildings)+
tm_polygons(col = "grey80",
size = 1,
border.col = "black",
border.lwd = 1)+
tm_shape(Employers) +
tm_dots(col = "red")
We can divide the whole area into four parts: northwestern, central, eastern, and southern areas. We can see that employers are mainly located in the northwetern and central areas but also spread a lot in other two areas.
tmap_mode("plot")
tm_shape(Buildings)+
tm_polygons(col = "grey80",
size = 1,
border.col = "black",
border.lwd = 1)+
tm_shape(Apartments) +
tm_dots(col = "yellow")
We can see that similar to the distribution of employers, apartments are also mainly located in northeastern and central areas.
tmap_mode("plot")
tm_shape(Buildings)+
tm_polygons(col = "grey80",
size = 1,
border.col = "black",
border.lwd = 1)+
tm_shape(Pubs) +
tm_dots(col = "blue", size = 0.05)+
tm_shape(Restaurants) +
tm_dots(col = "green", size = 0.05)+
tm_shape(schools) +
tm_dots(col = "purple", size = 0.05)
Similar to the distribution of employers and apartments, pubs, restaurants and schools are mainly located in northwestern and central areas. More specifically, there are two schools in northwestern area but no school in eastern area.
tmap_mode("view")
tm_shape(Buildings)+
tm_polygons(col = "grey90",
size = 1,
border.col = "black",
border.lwd = 1)+
tm_shape(Employers) +
tm_dots(col = "red")+
tm_shape(Apartments) +
tm_dots(col = "yellow")+
tm_shape(Pubs) +
tm_dots(col = "blue")+
tm_shape(Restaurants) +
tm_dots(col = "green")+
tm_shape(schools) +
tm_dots(col = "purple")
With this interactive graph, we can zoom in and out to see the overall distribution as well as the detailed information of each attributes.
We can find some trends:
In each area, we can see very clearly that apartments are gathered in certain areas which are a bit separated from the working office. This trend is clearest in central area, with working office in the center surrounding by residential buildings.
Pubs and restaurants are usually near to the working office, while schools are more isolated in the edge of the area.
logs_selected <-
read_rds("data/rds/logs_selected.rds")
tmap_mode("plot")
tm_shape(Buildings)+
tm_polygons(col = "grey60",
size = 1,
border.col = "black",
border.lwd = 1)+
tm_shape(logs_selected) +
tm_dots(col = "red")