Lesson 4 Part B

In the second part of this lab, point features from the California Department of Transportation (CALTRANS) are mapped using leaflet library. The point features represent highway rest areas across California. The underlying basemap is Open Street Map and points are represented by transparent circle markers with hover labels and popup icons. The map is centered over central valley California to show rest area concentration.

#Load package libraries

library(leaflet)
library(sf)
library(tidyverse)
library(here)
## here() starts at C:/PSU/GEOG588/WS_Lesson4

#Create map

calTransRestStops = read_csv(here("data", "Rest_Areas.csv")) %>%
  st_as_sf(coords = c("LONGITUDE", "LATITUDE"), crs = 4326)

leaflet(data = calTransRestStops) %>% 
  setView(lng= -120.1157639, lat= 36.7416723, zoom = 7) %>% 
  addTiles() %>%
  addCircleMarkers(popup = ~REST_AREA_NAME, label = ~CITY, radius = 4, color = "#FFA500") %>%
  addLegend(labels = "CALTRANS Rest Area", colors = "#FFA500")


Figure 4.) A leaflet map showing CALTRANS highway rest areas with hover labels showing local city names and popups showing facility names.