Skip to content

Commit e71e0e2

Browse files
authored
Merge branch 'main' into main
2 parents 77d1379 + ee3fdf7 commit e71e0e2

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,13 @@ into a single plot.
5252

5353
## Import Vector Data
5454

55-
We will use the `sf` package to work with vector data in R. `sf` stands for simple features.
56-
We will also use the `terra` and `ggplot2` packages, which have been loaded in previous episodes, so we can
57-
explore raster and vector spatial metadata using similar commands. Make sure
58-
you have the `sf` library loaded.
55+
We will use the `sf` package to work with vector data in R. `sf` stands for
56+
[simple features](https://en.wikipedia.org/wiki/Simple_Features), an international standard for
57+
representing spatial data that is used widely by databases (e.g., PostGIS) and other open source
58+
geospatial software (e.g., GDAL). We will also use the `terra` package, which has been loaded
59+
in previous episodes, so we can explore raster and vector spatial metadata using similar commands.
60+
61+
Make sure you have the `sf` library loaded.
5962

6063
```{r load-sf, results="hide", eval=FALSE, message=FALSE}
6164
library(sf)
@@ -172,6 +175,15 @@ ggplot() +
172175
coord_sf()
173176
```
174177

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

177189
## Challenge: Import Line and Point Vector Layers

0 commit comments

Comments
 (0)