2

Sometimes when using Earth Engine I got an incomplete image, is there a way to get the full image? Example:

enter image description here

The code that I am using is:

  var imageCollection = ee.ImageCollection("COPERNICUS/S2");
  var image_25 = ee.Image(imageCollection
    .filterDate('2016-05-01','2016-06-01')
    .filterMetadata('MGRS_TILE','equals','32VNK')
    .first())
    .select(['B2', 'B3', 'B4'])
  • 1
    The image is not 'incomplete'. The satellite captures images which are then split into a grid to make it easier to manage (previously the images were much larger and therefore took up more space). As the satellite doesn't travel the same vertical lines as per the grid, you will often have an image that has not captured the full extent of the grid, as above. – Walshe_d Jan 21 at 16:42
  • @ Walshe_d is there a way the get only the images that cover the full extent of the grid? – carlos Jan 21 at 17:27
4

Like Walshe pointed out, the images are split into a fixed grid. There are tiles that never get completely covered by a single image, so filtering out scenes is probably not a good idea. Normally, this isn't a problem. I suppose you could re-assemble the tiles by joining images from same day/spacecraft/orbit-number:

var aoi = ee.Geometry.Polygon(
  [[[24.06, 21.91],
    [24.06, 3.48],
    [35.53, 3.48],
    [35.53, 21.91]]], null, false);

var s2 = ee.ImageCollection('COPERNICUS/S2')
  .filterBounds(aoi)
  .filterDate('2019-01-01', '2019-01-05')
  .map(function (image) {
    return image
      .set('date', image.date().format('yyyy-MM-dd'));
  });

var daily = ee.ImageCollection(
    ee.Join.saveAll('images').apply({
      primary: s2, 
      secondary: s2, 
      condition: ee.Filter.and(
        ee.Filter.equals({
          leftField: 'date',
          rightField: 'date'
        }),
        ee.Filter.equals({
          leftField: 'SPACECRAFT_NAME',
          rightField: 'SPACECRAFT_NAME'
        }),
        ee.Filter.equals({
          leftField: 'SENSING_ORBIT_NUMBER',
          rightField: 'SENSING_ORBIT_NUMBER'
        })
      )
    })
  )
  .map(function (image) {
    return ee.ImageCollection(ee.List(image.get('images')))
      .mosaic()
      .set('system:time_start', ee.Date(image.get('date')).millis());
  });

Map.centerObject(aoi, 6);  
Map.addLayer(daily.first(), {bands: 'B4,B3,B2', min: 300, max: 3000});

https://code.earthengine.google.com/e79ee0f3353ab2ef1890a3376905fd5c

| improve this answer | |
  • Nice example of a multi-property join! – Justin Braaten Jan 21 at 18:54

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.