Map 5: Extended Campus

Detailed locator view of greater campus topography, bathymetry, buildings, and bikeways

Rendered Map Plate

Map 5 Extended Campus

Map 5: Greater campus topography, bathymetry, hillshading, buildings, and bike paths

Technical Summary

  • Objective: Serve as Inset 3 of the Map 7 tryptic (Zoom 3), transitioning from the regional Bight of California into the immediate coastal context of the UCSB campus and Goleta Slough.
  • Key Packages: terra, tidyverse, tidyterra, sf
  • Data Sources:
    • Campus DEM (source_data/campus_DEM.tif)
    • Campus hillshade (source_data/campus_hillshade.tif)
    • Offshore bathymetry (output_data/campus_bath_epsg2874.tif)
    • Campus buildings footprint (source_data/campus_buildings/Campus_Buildings.shp)
    • Isla Vista building structures (source_data/iv_buildings/iv_buildings/CA_Structures_ExportFeatures.shp)
    • Bike path centerlines (source_data/icm_bikes/bike_paths/bikelanescollapsedv8.shp)
    • NCOS Multi-use Trails (source_data/ncos_trails/ncos_multiuse_trails.geojson)
  • Styling Decisions:
    • 4 wide x 3 tall landscape aspect ratio (width = 4, height = 3) matching the Map 7 row 1 layout.
    • Axis labels, coordinate text, and tick marks removed.
    • Legend omitted (guide = "none", legend.position = "none").
    • White background set explicitly in ggsave for consistent rendering.

Step-by-Step Cartographic Workflow & Intermediate Outputs

The script scripts/map_05.R documents the systematic construction of Inset 3 (Zoom 3) across 6 intermediate visual iterations.

Step 1: Base Raster Layers — DEM & Hillshade Inspection

Before combining layers, the script inspects the raw campus digital elevation model and the multidirectional hillshade raster individually.

Map 5.1 Campus Hillshade

Intermediate Output 5.1: Campus hillshade rendered in grayscale

Map 5.2 UCSB DEM

Intermediate Output 5.2: UCSB DEM rendered with viridis gradient

Step 2: Intermediate Plot — Layer Blending & Graticule Tests

Next, the hillshade is placed over the DEM using an alpha transparency aesthetic (scale_alpha(range = c(0.05, 0.5))), followed by removing axis tick marks to prepare for inset tiling.

Map 5.3 Alpha Blending

Intermediate Output 5.3: Alpha-blended hillshade over DEM

Map 5.4 No Axis Labels

Intermediate Output 5.4: Stripping coordinate text and axis labels

Step 3: Integrating Offshore Bathymetry, Buildings & Bikeways

Onshore elevation alone left the Pacific Ocean blank white. By incorporating the bathymetry raster, coastal contours blend seamlessly with onshore topography. Vector layers for campus buildings, Isla Vista structures, and campus and NCOS bikeways are overlaid to ground the terrain, and the subtitle is removed for a cleaner locator presentation.

# Incorporating bathymetry, buildings, and bike paths
zoom_3_plot <- ggplot() +
  geom_raster(data = zoom_3_DEM_df, aes(x = x, y = y, fill = greatercampusDEM_1_1)) +
  geom_raster(data = campus_bath_df, aes(x = x, y = y, fill = bathymetry)) +
  scale_fill_viridis_c(na.value = "NA", guide = "none") +
  geom_raster(data = zoom_3_hillshade_df, aes(x = x, y = y, alpha = hillshade)) +
  scale_alpha(range = c(0.05, 0.4), guide = "none") +
  geom_sf(data = iv_buildings, color = alpha("gray70", 0.2), fill = NA, linewidth = 0.15) +
  geom_sf(data = buildings, color = "pink", fill = alpha("pink", 0.4), linewidth = 0.2) +
  geom_sf(data = bikeways, color = "#00abff", linewidth = 0.4) +
  geom_sf(data = ncos_trails, color = "#00abff", linewidth = 0.4) +
  my_theme +
  coord_sf(expand = FALSE) + 
  ggtitle("UCSB Surroundings")

Map 5.5 With Subtitle

Intermediate Output 5.5: Added Chumash land subtitle

Map 5.6 Batho-topo Overlay

Intermediate Output 5.6: Full batho-topo integrated surface

Full R Script (scripts/map_05.R)

Show R Code
#################################################
# zoom3
# Map 5 ########################################
# 

# clean the environment and hidden objects

rm(list=ls())

library(sf)
library(terra)
library(tidyterra)
library(geojsonsf)
library(ggplot2)
library(dplyr)

# set map number
current_sheet <- 5
# set ggplot counter
current_ggplot <- 0

# our auto ggtitle maker
gg_labelmaker <- function(plot_num){
  gg_title <- c("Map:", current_sheet, " ggplot:", plot_num)
  plot_text <- paste(gg_title, collapse=" " )
  print(plot_text)
  current_ggplot <<- plot_num
  return(plot_text)
}
# every ggtitle should be:
# ggtitle(gg_labelmaker(current_ggplot+1))
# end automagic ggtitle 



# ###########################
# Map 5
# Zoom 3: UCSB & Environs
# these come pre-made

campus_DEM <- rast("source_data/campus_DEM.tif")
plot(campus_DEM)
png("images/map5_base_dem.png", width = 1200, height = 900, res = 300)
plot(campus_DEM)
dev.off()

zoom_3_hillshade <- rast("source_data/campus_hillshade.tif")
plot(zoom_3_hillshade)
png("images/map5_base_hillshade.png", width = 1200, height = 900, res = 300)
plot(zoom_3_hillshade)
dev.off()


#################################################
# zoom3 as ggplot
campus_hillshade <- rast("source_data/campus_hillshade.tif")
str(campus_hillshade)
zoom_3_hillshade_df <- as.data.frame(campus_hillshade, xy=TRUE)
colnames(zoom_3_hillshade_df)

# let's make our ggplots shorter by saving
# our theme:
my_theme <- theme_minimal() +
  theme(axis.title.x = element_blank(), 
        axis.title.y = element_blank(), 
        axis.text.x = element_blank(), 
        axis.text.y = element_blank(), 
        axis.ticks = element_blank(),
        legend.position = "none", 
        panel.ontop = TRUE,
        panel.grid.major = element_line(color = "#FFFFFF33"),
        panel.grid.minor = element_blank(),
        panel.background = element_blank())



# ggplot the hillshade
zoom_3_plot <- ggplot() +
  geom_raster(data = zoom_3_hillshade_df,
              aes(x=x, y=y, alpha=hillshade)) +
  scale_alpha(range = c(0.05, 0.5), guide="none") +
  my_theme +
  coord_sf() + 
  ggtitle(gg_labelmaker(current_ggplot+1), subtitle = "Campus hillshade")

zoom_3_plot
ggsave("images/map5.1.png", width = 4, height = 3, plot = zoom_3_plot, bg = "white")

# ggplot the DEM
zoom_3_DEM_df <- as.data.frame(campus_DEM, xy=TRUE)
str(zoom_3_DEM_df)

zoom_3_plot <- ggplot() +
  geom_raster(data = zoom_3_DEM_df,
              aes(x=x, y=y, fill=greatercampusDEM_1_1)) +
  scale_fill_viridis_c(guide="none") +
  my_theme +
  coord_sf() + 
  ggtitle(gg_labelmaker(current_ggplot+1), subtitle = "UCSB DEM")

zoom_3_plot
ggsave("images/map5.2.png", width = 4, height = 3, plot = zoom_3_plot, bg = "white")

# now overlay
zoom_3_plot <- ggplot() +
  geom_raster(data = zoom_3_DEM_df,
              aes(x=x, y=y, fill=greatercampusDEM_1_1)) +
  scale_fill_viridis_c(guide = "none") +
  geom_raster(data = zoom_3_hillshade_df,
              aes(x=x, y=y, alpha=hillshade)) +
  scale_alpha(range = c(0.05, 0.5), guide="none") +
  my_theme +
  coord_sf() + 
  ggtitle("Map 5: zm 3: UCSB & Surroundings", subtitle = gg_labelmaker(current_ggplot+1))

zoom_3_plot
ggsave("images/map5.3.png", width = 4, height = 3, plot = zoom_3_plot, bg = "white")

# back out of the shortened theme and use what works
zoom_3_plot <- ggplot() +
  geom_raster(data = zoom_3_DEM_df,
              aes(x=x, y=y, fill=greatercampusDEM_1_1)) +
  scale_fill_viridis_c(guide = "none") +
  geom_raster(data = zoom_3_hillshade_df,
              aes(x=x, y=y, alpha=hillshade)) +
  scale_alpha(range = c(0.05, 0.5), guide="none") +
  my_theme +
  coord_sf() + 
  ggtitle("Map 5: zm 3: no axis labels", subtitle = gg_labelmaker(current_ggplot+1))

zoom_3_plot
ggsave("images/map5.4.png", width = 4, height = 3, plot = zoom_3_plot, bg = "white")

# back out of the shortened theme and use what works
zoom_3_plot <- ggplot() +
  geom_raster(data = zoom_3_DEM_df,
              aes(x=x, y=y, fill=greatercampusDEM_1_1)) +
  scale_fill_viridis_c(guide = "none") +
  geom_raster(data = zoom_3_hillshade_df,
              aes(x=x, y=y, alpha=hillshade)) +
  scale_alpha(range = c(0.05, 0.5), guide="none") +
  my_theme +
  coord_sf() + 
  ggtitle("UCSB Surroundings", subtitle = "on unceded land of the Chumash")

zoom_3_plot
ggsave("images/map5.5.png", width = 4, height = 3, plot = zoom_3_plot, bg = "white")



# zoom 3 needs water, bathymetry raster, buildings and bike paths
campus_bath <- rast("output_data/campus_bath_epsg2874.tif")
campus_bath_df <- as.data.frame(campus_bath, xy=TRUE) %>%
  rename(bathymetry = Bathymetry_2m_OffshoreCoalOilPoint)

# vector layers: buildings and bike paths
buildings <- st_read("source_data/campus_buildings/Campus_Buildings.shp")
iv_buildings <- st_read("source_data/iv_buildings/iv_buildings/CA_Structures_ExportFeatures.shp")
bikeways <- st_read("source_data/icm_bikes/bike_paths/bikelanescollapsedv8.shp")
ncos_trails <- st_read("source_data/ncos_trails/ncos_multiuse_trails.geojson")

camp_crs <- crs(campus_DEM)
buildings <- st_transform(buildings, camp_crs)
iv_buildings <- st_transform(iv_buildings, camp_crs)
bikeways <- st_transform(bikeways, camp_crs)
ncos_trails <- st_transform(ncos_trails, camp_crs)

# add bathymetry, hillshade, buildings and bike paths to the ggplot:
zoom_3_plot <- ggplot() +
  geom_raster(data = zoom_3_DEM_df,
              aes(x=x, y=y, fill=greatercampusDEM_1_1)) +
  geom_raster(data = campus_bath_df,
              aes(x=x, y=y, fill=bathymetry)) +
  scale_fill_viridis_c(na.value = "NA", guide = "none") +
  geom_raster(data = zoom_3_hillshade_df,
              aes(x=x, y=y, alpha=hillshade)) +
  scale_alpha(range = c(0.05, 0.4), guide="none") +
  geom_sf(data = iv_buildings, color = alpha("gray70", 0.2), fill = NA, linewidth = 0.15) +
  geom_sf(data = buildings, color = "pink", fill = alpha("pink", 0.4), linewidth = 0.2) +
  geom_sf(data = bikeways, color = "#00abff", linewidth = 0.4) +
  geom_sf(data = ncos_trails, color = "#00abff", linewidth = 0.4) +
  my_theme +
  coord_sf(expand = FALSE) + 
  ggtitle("UCSB Surroundings")

zoom_3_plot
ggsave("images/map5.6.png", width = 4, height = 3, plot = zoom_3_plot, bg = "white")

ggsave("images/map5.png", width = 4, height = 3, plot = zoom_3_plot, bg = "white")
ggsave("final_output/map_05.png", width = 4, height = 3, plot = zoom_3_plot, bg = "white")