From b8288b421ceadf7933acfbe6f555588eb59e84c1 Mon Sep 17 00:00:00 2001 From: Matthew Neilson Date: Tue, 12 Aug 2025 16:53:49 -0400 Subject: [PATCH] Explain coordinate system mismatch Add section to explain the mismatch between plot CRS and graticule CRS, and provide example on how to use CRS of first `geom_sf()` object to draw plot graticule --- episodes/06-vector-open-shapefile-in-r.Rmd | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/episodes/06-vector-open-shapefile-in-r.Rmd b/episodes/06-vector-open-shapefile-in-r.Rmd index 901335201..fd25d59be 100644 --- a/episodes/06-vector-open-shapefile-in-r.Rmd +++ b/episodes/06-vector-open-shapefile-in-r.Rmd @@ -172,6 +172,15 @@ ggplot() + coord_sf() ``` + +On the boundary plot, the x and y axes are labeled in units of decimal degrees. However, the CRS +for `aoi_boundary_HARV` is UTM zone 18N, which has units of meters. `geom_sf` will use +the CRS of the data to set the CRS for the plot, so why is there a mismatch? + +By default, `coord_sf()` generates a graticule with a CRS of WGS 84 (where the units +are decimal degrees), and this sets our axis labels. To draw the graticule in the native +CRS of our shapefile, we can set `datum=NULL` in the `coord_sf()` function. + ::::::::::::::::::::::::::::::::::::::: challenge ## Challenge: Import Line and Point Vector Layers