0

I want to calculate yearly (or monthly) mean/median/max for multiple image collections (Landsat4, 5, 7 and 8) for a certain area.

This is what I did so far:

  • I merged several Landsat image collections into one collection which contains Landsat 4, 5, 7, and 8.

  • I selected my bands of interest: my band selection for Landsat 4, 5, and 7 is B3,B6, B7, B5 and B4; while selection for Landsat 8 is B2, B5, B7, B4 and B3.

  • I filtered my full image collection (L4-L8) according to this band selection and region of interest (roi).

So now I have to calculate "the best" image per year within this selection. I read several things about calenderRange or reducers, but I cannot get it working so far.

Update: code is now added below.

// variables
var point =  ee.Geometry.Point([-8.7, 38.5]);
var bandSelect = ['green', 'swir1', 'swir2', 'nir', 'red'];
var bands8 = ['B3', 'B6', 'B7', 'B5', 'B4'];
var bands7 = ['B2', 'B5', 'B7', 'B4', 'B3'];

// data
function generateLandsatCollection(){
  var l4collection = ee.ImageCollection('LANDSAT/LT04/C01/T1')
    .filterBounds(point)
    .select(bands7, bandSelect);
  var l5collection = ee.ImageCollection('LANDSAT/LT05/C01/T1')
    .filterBounds(point)
    .select(bands7, bandSelect);
  var l7collection = ee.ImageCollection('LANDSAT/LE07/C01/T1_RT')
    .filterBounds(point)
    .select(bands7, bandSelect);
  var l8collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_RT')
    .filterBounds(point)
    .select(bands8, bandSelect);
  var collectionFull = ee.ImageCollection(l4collection
  .merge(l5collection)
  .merge(l7collection)
  .merge(l8collection));
  return collectionFull
}

var collection = generateLandsatCollection();
print(collection)
  • 2
    Please provide reproducible code. – JepsonNomad Feb 7 at 18:19
  • 1
    Welcome to GIS SE! We're a little different from other sites. We're a Q&A site, not a discussion forum. For questions that involve code we ask that you show us where you are stuck with your own code by including a code snippet in your question. There is an edit button beneath your question which will enable you to do that and a {} button that enables you to format any highlighted code nicely. Please check out our short tour for more about how the site works. Thanks. – PolyGeo Feb 7 at 23:23

Your Answer

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

Browse other questions tagged or ask your own question.