0

I wish to export NDVI layer as image to my Google Drive. I can run the code seamlessly but nothing is exported into my drive after the code is executed.

Here is my code:

import ee
import ee.mapclient
import datetime
import ee.batch as batch

ee.Initialize()

roi_lat = 14.82762
roi_lon = 101.079659

ullat = roi_lat + 0.01
ullon = roi_lon - 0.01

lrlat = roi_lat - 0.01
lrlon = roi_lon + 0.01


geometry = ([ullon,ullat], [lrlon, ullat],[lrlon, lrlat],[ullon, lrlat])

l8 = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA')

image = ee.Image(
    (l8.filterBounds(point)
       .filterDate(datetime.datetime(2018, 1, 1), datetime.datetime(2018, 12, 31))
       .sort('CLOUD_COVER')
       .first()
      )
)

def NDVI(image):
 return image.expression('float(b("B5") - b("B4")) / (b("B5") + b("B4"))')

ndvi = l8.map(NDVI).mean()

visualization = ndvi.visualize({
    'min': 0,
    'max': 1,
    'palette': ['FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163',
              '99B718', '74A901', '66A000', '529400', '3E8601',
              '207401', '056201', '004C00', '023B01', '012E01',
              '011D01', '011301']
})

task_config = {
    'description': 'NDVI',
    'scale': 30,
    'region':geometry
}

print("Starting to create a image")
out = ee.batch.Export.image(visualization,'l8_ndvi', task_config)
process = batch.Task.start(out)
print("Process sent to cloud")

If anyone has any knowledge. Please enlighten me where did I go wrong?

Thanks.

Esther
  • 65
  • 1
  • 10

1 Answers1

1

What you want is out = ee.batch.Export.image.toDrive(...). You can start that with out.start(). You can monitor tasks with ee.batch.Task.list() or use the Tasks tab of the Code Editor.