library(sf)
## Linking to GEOS 3.10.2, GDAL 3.4.1, PROJ 7.2.1; sf_use_s2() is TRUE
library(raster)
## Loading required package: sp
library(terra)
## terra 1.7.29
library(spData)
library(spDataLarge)
library(tidyverse)
## -- Attaching core tidyverse packages ------------------------ tidyverse 2.0.0 --
## v dplyr     1.1.2     v readr     2.1.4
## v forcats   1.0.0     v stringr   1.5.0
## v ggplot2   3.4.3     v tibble    3.2.1
## v lubridate 1.9.2     v tidyr     1.3.0
## v purrr     1.0.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x tidyr::extract() masks terra::extract(), raster::extract()
## x dplyr::filter()  masks stats::filter()
## x dplyr::lag()     masks stats::lag()
## x dplyr::select()  masks raster::select()
## i Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ggspatial)
library(patchwork)
## 
## Attaching package: 'patchwork'
## 
## The following object is masked from 'package:terra':
## 
##     area
## 
## The following object is masked from 'package:raster':
## 
##     area
data1 = st_read((system.file("vector/zion.gpkg", package = "spDataLarge")))
## Reading layer `zion' from data source 
##   `C:\Users\acaug\Documents\R\win-library\4.1\spDataLarge\vector\zion.gpkg' 
##   using driver `GPKG'
## Simple feature collection with 1 feature and 11 fields
## Geometry type: POLYGON
## Dimension:     XY
## Bounding box:  xmin: 302903.1 ymin: 4112244 xmax: 334735.5 ymax: 4153087
## Projected CRS: UTM Zone 12, Northern Hemisphere
data2 = us_states %>% janitor::clean_names() %>% filter(name == "Utah")
data = data1
data1
## Simple feature collection with 1 feature and 11 fields
## Geometry type: POLYGON
## Dimension:     XY
## Bounding box:  xmin: 302903.1 ymin: 4112244 xmax: 334735.5 ymax: 4153087
## Projected CRS: UTM Zone 12, Northern Hemisphere
##   UNIT_CODE
## 1      ZION
##                                                                             GIS_Notes
## 1 Lands - http://landsnet.nps.gov/tractsnet/documents/ZION/Metadata/zion_metadata.xml
##            UNIT_NAME  DATE_EDIT STATE REGION GNIS_ID     UNIT_TYPE CREATED_BY
## 1 Zion National Park 2017-06-22    UT     IM 1455157 National Park      Lands
##                                                                    METADATA
## 1 https://irma.nps.gov/App/Reference/Profile/2181118#Zion National Monument
##   PARKNAME                           geom
## 1     Zion POLYGON ((314945.2 4115910,...
data2
## Simple feature collection with 1 feature and 6 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: -114.0506 ymin: 36.998 xmax: -109.0418 ymax: 42.00157
## Geodetic CRS:  NAD83
##   geoid name region            area total_pop_10 total_pop_15
## 1    49 Utah   West 219859.8 [km^2]      2657236      2903379
##                         geometry
## 1 MULTIPOLYGON (((-114.0417 4...
ggplot() +
  geom_sf(data = data2) + geom_sf(data = data1) +
  theme(axis.text = element_blank()) +
  theme(axis.ticks = element_blank())