Filtering an ImageCollection

As illustrated in the Get Started section and the ImageCollection Information section, Earth Engine provides a variety of convenience methods for filtering image collections. Specifically, many common use cases are handled by imageCollection.filterDate(), and imageCollection.filterBounds(). For general purpose filtering, use imageCollection.filter() with an ee.Filter as an argument. The following example demonstrates both convenience methods and filter() to identify and remove images with bad registration from an ImageCollection:

// Load Landsat 5 data, filter by date and bounds.
var collection = ee.ImageCollection('LT5_L1T')
  .filterDate('1990-01-01', '1990-05-31')
  .filterBounds(ee.Geometry.Point(24.9478, -17.8756));

// Also filter the collection by registration parameters.
var filtered = collection
  .filter(ee.Filter.gt('google:registration_count', 1000))
  .filter(ee.Filter.gt('google:registration_offset_x', -100))
  .filter(ee.Filter.lt('google:registration_offset_x', 100))
  .filter(ee.Filter.lt('google:registration_offset_y', 100))
  .filter(ee.Filter.gt('google:registration_offset_y', -100));

// Create two composites to check the effect of filtering by registration.
var badComposite = ee.Algorithms.Landsat.simpleComposite(collection, 75, 3);
var goodComposite = ee.Algorithms.Landsat.simpleComposite(filtered, 75, 3);

// Display the composites.
Map.setCenter(25.84242, -17.92272, 13);
Map.addLayer(badComposite,
             {bands: ['B3', 'B2', 'B1'], gain: 3.5},
             'bad composite');
Map.addLayer(goodComposite,
             {bands: ['B3', 'B2', 'B1'], gain: 3.5},
             'good composite');
    

Enviar comentarios sobre…

Google Earth Engine API