Skip to content

Commit b8288b4

Browse files
committed
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
1 parent c99bee2 commit b8288b4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

episodes/06-vector-open-shapefile-in-r.Rmd

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,15 @@ ggplot() +
172172
coord_sf()
173173
```
174174

175+
176+
On the boundary plot, the x and y axes are labeled in units of decimal degrees. However, the CRS
177+
for `aoi_boundary_HARV` is UTM zone 18N, which has units of meters. `geom_sf` will use
178+
the CRS of the data to set the CRS for the plot, so why is there a mismatch?
179+
180+
By default, `coord_sf()` generates a graticule with a CRS of WGS 84 (where the units
181+
are decimal degrees), and this sets our axis labels. To draw the graticule in the native
182+
CRS of our shapefile, we can set `datum=NULL` in the `coord_sf()` function.
183+
175184
::::::::::::::::::::::::::::::::::::::: challenge
176185

177186
## Challenge: Import Line and Point Vector Layers

0 commit comments

Comments
 (0)