1

I am trying to use the GEE Python API to export an image to Google Drive. Everything works smooth, except the exporting stage.

boundary = ee.Feature(Countries.first()).geometry().bounds().getInfo()['coordinates']

task_config = {
    'fileNamePrefix': 'image',
    'crs': 'EPSG:4326',
    'scale': 500,
    'maxPixels': 10e15,
    'fileFormat': 'GeoTIFF',
    'skipEmptyTiles': True,
    'region': boundary ,
    'folder': 'myfolder'
    }

task = ee.batch.Export.image.toDrive(image, str('image'), task_config)
task.start()

Where I get the following error:

Traceback (most recent call last):
  File "<input>", line 19, in <module>
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\ee\batch.py", line 81, in start
    result = data.exportImage(self._request_id, self.config)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\ee\data.py", line 1126, in exportImage
    return startProcessing(request_id, params)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\ee\deprecation.py", line 32, in Wrapper
    return func(*args, **kwargs)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\ee\data.py", line 1100, in startProcessing
    return send_('/processingrequest', args)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\ee\data.py", line 1669, in send_
    raise ee_exception.EEException(json_content['error']['message'])
ee.ee_exception.EEException: Invalid request: 'driveFolder': Must be at most 255 characters.

It's like the parameter 'folder' was not read correctly, because in my Google Drive I then find an emtpy (since the task fails) folder named not after 'myfolder', as I specified, but after the long, entire list of parameters I specified in task_config. Any clue?

2

I haven't test it, but I think the issue comes from parsing task_config as a dictionary. To keep your code without much modifications, just do:

task = ee.batch.Export.image.toDrive(image, str('image'), **task_config)

the ** will unpack the dict parsing it as keywords.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.