Spatial Joins

library(sf)
library(dplyr)
library(tmap)

ard_path <- "data/AnalysisReady/AnalysisReady.gpkg"

segipts <- st_read(ard_path, "segi_points")
ws <- st_read(ard_path, "watersheds")

# Get just the name column from watersheds and rename it to watershed
ws <- ws %>% 
  select(name) %>% 
  rename(watershed = name)
# Join watershed info to sequoia locations
segiws <- st_join(segipts, ws, join = st_intersects)

tmap_mode("view")
map <- tm_shape(ws)+
  tm_polygons()+
  tm_shape(segiws)+
  tm_dots("watershed")
map