0

In google earth explorer you can load Landsat image around a roi. You can then conduct analysis on this image. I want to expand my region to cover a whole country or continent rather than just the small box defined by the roi. I've tried changing my roi to a polygon instead but this still only returns one image.

// filtering the image collection
var image = ee.Image(ee.ImageCollection('LANDSAT/LC8_L1T_TOA')
  .filterBounds(roi)    
  .filterDate('2015-01-01', '2015-12-31')    
  .sort('CLOUD_COVER')    
  .first());
Map.addLayer(image, {bands: ['B4', 'B3', 'B2'], max: 0.3}, 'landsat');

I need to expand the Landsat imagery to cover the whole country

You can see in the image I have my region of interest on the coastline of Bangladesh. I need to expand the Landsat image to cover a larger area.

1

When you filter the ImageCollection by roi you get an ImageCollection in which every image intersects the roi, but images still are individual images. So when you call .first() you are getting just one image out of the collection (that has more than one). What you need is a mosaic. There are many ways to make a mosaic, but the simpler one is to call .mosaic()

// filtering the image collection
var image = ee.Image(ee.ImageCollection('LANDSAT/LC8_L1T_TOA')
  .filterBounds(roi)    
  .filterDate('2015-01-01', '2015-12-31')    
  .sort('CLOUD_COVER')    
  .mosaic());
Map.addLayer(image, {bands: ['B4', 'B3', 'B2'], max: 0.3}, 'landsat'); 
  • this works, but when I go to find the .median() for all of the images returned I get an error image.mosaic is not a function – Samual Chance Sep 24 '18 at 0:37
  • 1
    when you apply a reducer (median, mean, etc) over an ImageCollection you get an Image as the result, and you can only mosaic collections, not images. Reducing the image would be another way of making a mosaic – Rodrigo E. Principe Sep 24 '18 at 1:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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