3

Landsat 8 Collection 1 Tier 1 8-Day EVI Composite. I continued with the starting codes given by Google Earth Engine. I tried to solve my work by adding code to the rest of these codes. However, it keeps giving an error.

Codes:

var dataset = ee.ImageCollection('LANDSAT/LE07/C01/T1_8DAY_EVI')
                  .filterDate('2006-03-30','2006-10-10');
var colorized = dataset.select('EVI');
var colorizedVis = {
  min: 0.0,
  max: 1.0,
  palette: [
    'FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901',
    '66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01',
    '012E01', '011D01', '011301'
    
  ],
};
Map.setCenter(32, 37, 6);
Map.addLayer(colorized, colorizedVis, 'Colorized');
var landsat = ee.Image('LANDSAT/LE07/C01/T1_8DAY_EVI');
var geometry = ee.Geometry.Rectangle([31, 36, 34, 39]);
Export.image.toDrive({
  image:dataset,
  description: 'imageToDriveExample',
  scale: 30,
  region: geometry
});
Error: Image.clipToBoundsAndScale, argument 'input': Invalid type.
  Expected type: Image<unknown bands>. Actual type: ImageCollection.

How can I fix this code?


A) EVI is not a band, but a separate index (a single value) obtained after a certain mathematical operation is applied to the bands. Therefore, the following command: [image: dataset.toBand ()] did not work. I tried all of them (image1_band1), (image1), (band1) in this statement but never accepted.

B) dataset.first() This code has been accepted. However, whatever you put in parentheses, it definitely downloads something. However, this is not EVI.

C) dataset.get(x) (x: image index),This code does not work either. I wrote everything that could be "index" by looking at the Google Engine inspector section. However, it did not happen again.

D) Use a reducer On this page, there is a lot of information such as choosing wavelength bands and taking the average.

My situation is simple. I want certain dates from the EVI index, which is ready in Google engine. I'm writing the latest working code below. This code downloads images. However, this image does not have an image.

The Code:

var dataset = ee.ImageCollection('LANDSAT/LE07/C01/T1_8DAY_EVI')
                  .filterDate('2006-03-30','2006-10-10');
var colorized = dataset.select('EVI');
var colorizedVis = {
  min: 0.0,
  max: 1.0,
  palette: [
    'FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901',
    '66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01',
    '012E01', '011D01', '011301'
    
  ],
};
Map.setCenter(32, 37, 6);
Map.addLayer(colorized, colorizedVis, 'Colorized');
var geometry = ee.Geometry.Rectangle([31, 36, 34, 39]);
Export.image.toDrive({
  image:dataset.first(20060330),
  description: 'imageToDriveExample',
  scale: 3000,
  region: geometry
});

For example, these image is that:
enter image description here

Another image:
enter image description here

1

1 Answer 1

4

The error refers that you use ImageCollection although Export.image.toDrive function expects one Image. You must pass an Image to image parameter.

If you want to export to drive,

  • you can use image: dataset.toBand() (Documentation),
  • or choose one image using i.e. dataset.first() or dataset.get(x) (x: image index),
  • or use Export.image.toDrive in for loop to export all images separately,
  • or use a reducer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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