Last active
April 29, 2022 15:50
-
-
Save h-a-graham/88852897f4e4f5b0607362bd7ea5eedb to your computer and use it in GitHub Desktop.
GEE driver example in R
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(gdalio) | |
library(terra) | |
library(viridisLite) | |
source(system.file("raster_format/raster_format.codeR", package = "gdalio", mustWork = TRUE)) | |
Sys.setenv(GOOGLE_APPLICATION_CREDENTIALS = "MYKEY.json") | |
gee_src <- "EEDAI:CGIAR/SRTM90_V4" | |
src_info <- vapour::vapour_raster_info(gee_src) | |
gdalio_set_default_grid(extent=src_info$extent, | |
dimension = c(180, 90)*10, | |
projections = src_info$projstring) | |
r <- gdalio_terra(gee_src, bands=1) | |
plot(r, range=c(0,4000), col=rocket(256)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(raytrix) | |
library(rayshader) | |
Sys.setenv(GOOGLE_APPLICATION_CREDENTIALS = "MYKEY.json") | |
set_canvas_centroid(45.832, 6.865, radius = 50e3) | |
gee_src <- "EEDAI:CGIAR/SRTM90_V4" | |
srtm <- topo_matrix(30, src=gee_src) | |
tex <- srtm %>% | |
sphere_shade(texture='imhof2', zscale=30) %>% | |
add_shadow(ray_shade(srtm, zscale = 30, sunaltitude = 25), max_darken = 0.1) | |
plot_3d(tex, srtm, zscale=30, | |
theta=-30, phi=15, zoom=0.2) | |
render_depth(filename = 'test_shade.png', focallength=10) |
Author
h-a-graham
commented
Apr 29, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment