Open mcgregorian1 opened 2 years ago
The correct syntax is batch.Download.ImageCollection.toDrive
. The error Cannot read property <property> of undefined
generally means that you are trying to access a property (toDrive
in this case) of an object that does not exist or is null
. This is a sign that you should inspect the parent object further. In this case, the parent object batch.ImageCollection
does not exist because batch
has no property ImageCollection
.
As a general note in EE javascript, when you require
a javascript file, the object returned is a dictionary with the properties given by any exports that were assigned in the script. The batch
script only has two exports: exports.getRegion
and exports.Download
.
You can access batch
's exported objects with batch.<objectName>
. In the batch script, the dictionary object Download
is exported at the end of the script using exports.Download = Download
.
The Download
object is defined as a dictionary. Then, the ImageCollection.toDrive
function is defined as a property of the Downloads dictionary using Download.ImageCollection.toDrive
.
Hi, I was trying to use
batch.ImageCollection.toDrive
and I received the error:I tried running the code directly from source and it only worked when I changed the
region
parameter tonull
inExport.Image.toDrive
and exported onlyimg
instead ofimgType
. Do you know why the error occurred?Here is my code with the failure:
And here is the source code I used that worked: