JesJehle / earthEngineGrabR

Simplify the acquisition of remote sensing data
https://jesjehle.github.io/earthEngineGrabR/
53 stars 5 forks source link

Error reading targetArea #4

Closed mgmanalili closed 5 years ago

mgmanalili commented 5 years ago

Hello, I have successfully installed earthengineGrabR but I was not able to run it properly.

I tried this snippet from the documentation. But I am getting an error even though the shapefile exist in my local machine.

Error: No targetArea specified. Please specify a targetArea with a path to a local geo-file of class character.

Thanks!


library(earthEngineGrabR)
library(rgdal)
library(raster)

srtm_data <- ee_grab(data = ee_data_image(datasetID = "CGIAR/SRTM90_V4",
                                          spatialReducer = "mean",
                                          scale = 100,
                                          bandSelection = "elevation"
),
targetArea = system.file("/Users/michael/Downloads/layers/POLYGON.shp", package = "earthEngineGrabR")
)
JesJehle commented 5 years ago

Hey, sorry for the late answer. The function 'system.file()' looks in the R-package directory, this is not what you need. Just give "/Users/michael/Downloads/layers/POLYGON.shp" directly to targetArea like this:

srtm_data <- ee_grab(data = ee_data_image(datasetID = "CGIAR/SRTM90_V4",
                                          spatialReducer = "mean",
                                          scale = 100,
                                          bandSelection = "elevation"
),
targetArea = "/Users/michael/Downloads/layers/POLYGON.shp"
)