r-spatial / rgee

Google Earth Engine for R
https://r-spatial.github.io/rgee/
Other
691 stars 148 forks source link

Take GEDI L2A Vector Canopy Top Height data #328

Open Leprechault opened 1 year ago

Leprechault commented 1 year ago

I'd like to extract GEDI data from GEE, for this I try:

# 1. Load rgee
library("rgee")
ee_Initialize(drive=TRUE) 

# Packages
library(tidyverse)
library(rgee)
library(sf)
ee_Initialize(drive=TRUE)

# Define a Region of interest
roi <-ee$Geometry$Point(-16.12231,-57.68973)$buffer(500)

# GEDI L2A Vector Canopy Top Height (Version 2) the Earth Engine’s public data archive         
l2a <- ee$FeatureCollection("LARSE/GEDI/GEDI02_A_002")

# Date window
l2a_date  <- l2a$filterBounds(roi)$filter(ee$Filter$date(as.character("2022-12-01"), as.character("2023-04-20")))

#Downloading the data
outdir=getwd()
S1_ic_local <- ee_extract(
  x = l2a_date,
  y = roi,
  dsn =  outdir)

Error in ee_extract(x = l2a_date, y = roi, dsn = outdir) : 
  x is neither an ee$Image nor ee$ImageCollection

Doesn't work. I'd like all the footprints of the GEDI inside the polygon roi in a table format or in the *h5 original format.

Please, could you help me?