## rgeedim v0.4.0 -- using geedim 2.0.0 w/ earthengine-api 1.7.10
## terra 1.8.97
## Using Application Default Credentials (ADC)
## hillshade example
b <- gd_bbox(
xmin = -120.296,
xmax = -120.227,
ymin = 37.9824,
ymax = 38.0071
)
# download 1m DEM in AEA
# need to set resampling method in composite step
x <- "USGS/3DEP/1m" |>
gd_collection_from_name() |>
gd_search(region = b) |>
gd_composite(
resampling = "bilinear"
) |>
gd_download(
region = b,
bands = list("elevation"),
crs = "EPSG:5070",
scale = 10,
filename = "dem.tif"
) |>
rast()
# calculate slope, aspect, and hillshade with terra
slp <- terrain(x, "slope", unit = "radians")
asp <- terrain(x, "aspect", unit = "radians")
hs <- shade(slp, asp)
# compare elevation v.s. hillshade
plot(c(x, hillshade = hs))
