This leaflet based map shows the 2045 estimated population of Washington, DC compared to the public ally available bike racks in the city. The polygons are census tracts and the darker red the tract is, the greater predicted population increase that tract is estimating to increase by. On top of this data are the bike racks. The comparison shows some unique characteristics between the clusterings of bike stands and perdicted population growth.
#Installing packages ----
library(leaflet)
library(sf)
library(tidyverse)
library(USAboundaries)
library(here)
#Reading in the DC population and employment forcast GeoJSON
DC_Data <- sf::read_sf('https://maps2.dcgis.dc.gov/dcgis/rest/services/DCGIS_DATA/MoveDC/MapServer/10/query?outFields=*&where=1%3D1&f=geojson')
bikes <- sf::read_sf('https://maps2.dcgis.dc.gov/dcgis/rest/services/DCGIS_DATA/Transportation_Bikes_Trails_WebMercator/MapServer/168/query?outFields=*&where=1%3D1&f=geojson')
#Mapping the data
#Mapping 2045 estimated population density increases
#Filter Bikes to not include ANC 3G
bikes <- bikes %>%
filter((ANC_ID != '3G') %>%
replace_na(T))
#Creating bike icons
icons = awesomeIcons(icon = 'bicycle', markerColor = "lightblue", library = 'fa')
#Mapping Data
DC_Data %>%
filter(PCTCHANGE > 0.0) %>%
leaflet() %>%
addProviderTiles(providers$CartoDB) %>%
addPolygons(stroke = FALSE, smoothFactor = 0.3, fillOpacity = 0.8,
fillColor = ~colorQuantile('Reds', PCTCHANGE)(PCTCHANGE),
label = ~paste0("Percentage Change: ", PCTCHANGE, "%")) %>%
addAwesomeMarkers(data = bikes, icon = icons, popup = ~ANC_ID, clusterOptions = markerClusterOptions()) %>%
addLegend("bottomright",
colors = c("#a50f15", "#de2d26", "#fb6a4a", "#fcae91", "#fee5d9"),
labels = c("More", "", "", "", "Less"),
title = "2045 PopDen Increase",
opacity = 0.75)