@@ -18,7 +18,8 @@ source("setup.R")
18
18
19
19
:::::::::::::::::::::::::::::::::::::::: questions
20
20
21
- - How can I crop raster objects to vector objects, and extract the summary of raster pixels?
21
+ - How can I crop raster objects to vector objects, and extract the summary of
22
+ raster pixels?
22
23
23
24
::::::::::::::::::::::::::::::::::::::::::::::::::
24
25
@@ -215,7 +216,8 @@ CHM_plots_HARVcrop <- crop(x = CHM_HARV, y = plot_locations_sp_HARV)
215
216
CHM_plots_HARVcrop_df <- as.data.frame(CHM_plots_HARVcrop, xy = TRUE)
216
217
217
218
ggplot() +
218
- geom_raster(data = CHM_plots_HARVcrop_df, aes(x = x, y = y, fill = HARV_chmCrop)) +
219
+ geom_raster(data = CHM_plots_HARVcrop_df,
220
+ aes(x = x, y = y, fill = HARV_chmCrop)) +
219
221
scale_fill_gradientn(name = "Canopy Height", colors = terrain.colors(10)) +
220
222
geom_sf(data = plot_locations_sp_HARV) +
221
223
coord_sf()
@@ -322,7 +324,7 @@ We will begin by extracting all canopy height pixel values located within our
322
324
Harvard Forest field site.
323
325
324
326
``` {r extract-from-raster}
325
- tree_height <- extract(x = CHM_HARV, y = aoi_boundary_HARV, df = TRUE )
327
+ tree_height <- extract(x = CHM_HARV, y = aoi_boundary_HARV, raw = FALSE )
326
328
327
329
str(tree_height)
328
330
```
0 commit comments