[GIS] Export satellite images for an entire country from Google Earth Engine

google-earth-engine

How can I download all the satellite images covering an entire country(Kenya) for a period of years from Google Earth Engine? I drew a large geometry polygon over the entire country and then tried to get the images by using filterBounds() but doesnt seem to be working. What am I doing wrong?

enter image description here

var roi = /* color: #0b4a8b */ee.FeatureCollection(
    [ee.Feature(
        ee.Geometry.Polygon(
            [[[41.484375, -1.6477220517969224],
              [39.5068359375, 3.447624666646865],
              [35.2880859375, 4.981505049328245],
              [33.99169921875, 4.23685605976896],
              [34.98046875, 2.1088986592431382],
              [33.99169921875, -0.9447814006873896],
              [39.2431640625, -4.740675384778361]]]),
        {
          "system:index": "0"
        })]);



var image = ee.Image(ee.ImageCollection('MODIS/MOD09A1')
.filterBounds(roi)
.filterDate('2010-01-01', '2013-12-31')
.sort('CLOUD_COVER')
.first()
);
Map.addLayer(image, {bands: ['sur_refl_b01', 'sur_refl_b03', 
'sur_refl_b04'], max: 0.5, gamma: 2}, "Modis Image");

Best Answer

Your problem is that MODIS doesn't have CLOUD_COVER metadata, so filtering for it returns no image. The MODIS images you're accessing are global, so that sort of metadata doesn't make any sense.

Also, your scaling is off (you need to specify a min and the images are scaled by 0.0001.

var image = ee.Image(ee.ImageCollection('MODIS/MOD09A1')
  .filterBounds(roi)
  .filterDate('2010-01-01', '2013-12-31')
  .first());
Map.addLayer(image, {
  bands: ['sur_refl_b01', 'sur_refl_b04', 'sur_refl_b03'], min:0, max: 4000},
  "Modis Image");