Google Earth Engine – Download Landsat Data for Continental USA

downloadgoogle-earth-enginelandsat

I need to download one image of the Landsat 7 NDVI 32 day from Google earth engine for the continental United States. Just this specific one image from 2005-08-13 to 2005-09-14. Please see my code below:

//Import Landsat Image
var L7200508NDVI = ee.ImageCollection('LANDSAT/LE7_L1T_32DAY_NDVI')
.filterDate('2005-08-13', '2005-09-14')
.filterBounds(region);

print('L7200508NDVI', L7200508NDVI);
Map.addLayer(L7200508NDVI);

// Load a region representing the United States //this doesn't work as my boundary
var region = ee.FeatureCollection('ft:1tdSwUL7MVpOauSgRzqVTOwdfy17KDbw-1d9omPw')
.filter(ee.Filter.eq('Country', 'United States'));
Map.addLayer(region);

// Create a small area to test: geometry representing an export region.
var geometry = ee.Geometry.Rectangle([116.2621, 39.8412, 116.4849, 40.01236]);

// Export the image, specifying scale and region.
Export.image.toDrive({
  image: L7200508NDVI,
  description: 'imageToDriveExample',
  scale: 30,
  region: geometry,
  maxPixels:1e11
});
  1. if I use the test geometry I got the error:
    Error: Invalid argument: 'image' must be of type Image.

  2. i am not sure how to create a polygon just right for the Continental United States. or do I need import a polygon from my ArcGIS layer?

Best Answer

You are working with an ImageCollection, which contains overlapping images. For export you need a single image. One way to go from an ImageCollection to an image is use a simple reducer such as taking the mean of the overlapping parts.

To mask everything outside the continental clip the image to the region.

Export does not support MultiPolygons. But you can use the bounding box of your region and skip the empty tiles (i.e. the parts you have masked with clip).

// Load a region representing the United States //this doesn't work as my boundary
var region = ee.FeatureCollection('ft:1tdSwUL7MVpOauSgRzqVTOwdfy17KDbw-1d9omPw')
.filter(ee.Filter.eq('Country', 'United States'));

//Import Landsat Image
var L7200508NDVI = ee.ImageCollection('LANDSAT/LE7_L1T_32DAY_NDVI')
  // .filterDate('2005-08-13', '2005-09-14')
  .filterBounds(region);

print('L7200508NDVI', L7200508NDVI);

Map.addLayer(L7200508NDVI.mean().clip(region));

// Export the image, specifying scale and region.
Export.image.toDrive({
  image: L7200508NDVI.mean().clip(region),
  description: 'imageToDriveExample',
  scale: 30,
  region: region.geometry().bounds(),
  maxPixels:1e11,
  skipEmptyTiles: true
});
Related Question