# NOT RUN {
library(rgee)
library(stars)
ee_reattach() # reattach ee as a reserved word
ee_Initialize()
nc <- st_read(system.file("shp/arequipa.shp", package = "rgee"))
dem_palette <- c(
"#008435", "#1CAC17", "#48D00C", "#B3E34B", "#F4E467",
"#F4C84E", "#D59F3C", "#A36D2D", "#C6A889", "#FFFFFF"
)
ndvi_palette <- c(
"#FC8D59", "#FC8D59", "#FC9964", "#FED89C", "#FFFFBF",
"#FFFFBF", "#DAEF9F", "#9DD46A", "#91CF60", "#91CF60"
)
# Example 01 - SRTM AREQUIPA-PERU
image <- ee$Image("CGIAR/SRTM90_V4")
region <- nc$geometry[[1]] %>%
st_bbox() %>%
st_as_sfc() %>%
st_set_crs(4326) %>%
sf_as_ee()
arequipa_dem <- ee_as_thumbnail(x = image, region = region,
vizparams = list(min = 0, max = 5000))
arequipa_dem <- arequipa_dem * 5000
plot(x = arequipa_dem[nc], col = dem_palette, breaks = "equal",
reset = FALSE, main = "SRTM - Arequipa")
suppressWarnings(plot(x = nc, col = NA, border = "black", add = TRUE,
lwd = 1.5))
# }
Run the code above in your browser using DataLab