I am trying to export a collection of Landsat images (but at this point I will settle for a single image) from Google Earth Engine to my Google Drive. I am using the Python API from my local terminal but I can not get the Export.image.toDrive (or ee.batch.Export.image.toDrive) to work. I even tried the code in the JavaScript code editor (in JavaScript, not Python) and it didn't work there either.
I have tried everything I can find on Google API Docs, StackOverflow, and GIS StackExchange - nothing has worked for me.
Eventually I need to iterate over an ImageCollection but to keep it simple for initial export here is my code for a single image:
#python
import datetime
import ee
import ee.mapclient
ee.Initialize()
#download a polygon to clip the collection of images down to
okla = (ee.FeatureCollection('TIGER/2018/States') #get oklahoma polygon to filter images by, this polygon is correct
.filter(ee.Filter().eq('NAME','Oklahoma')))
#download image collection
collection = (ee.ImageCollection('LANDSAT/LE07/C01/T1_SR')
.filterDate(datetime.datetime(2012, 1, 1),
datetime.datetime(2012, 1, 30)) #set dates to download (year,month,day)
.filterBounds(okla)) #this is not a full clip
#condense collection to single image (do not want to do this in the future)
image1 = collection.mean() #takes the average of images in collection
image2 = image1.clipToCollection(okla) #this works and actually clips images to outline of Oklahoma
taskToexport = ee.batch.Export.image.toDrive(
image = image2,
description = 'test1',
)
taskToexport.start()
ee.Date.fromYMD(2012, 1, 1)
instead ofdatetime.datetime(2012, 1, 1)
.