Filtrer une ImageCollection
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Comme illustré dans la section Premiers pas et la section Informations sur ImageCollection, Earth Engine fournit diverses méthodes pratiques pour filtrer les collections d'images.
Plus précisément, de nombreux cas d'utilisation courants sont gérés par imageCollection.filterDate()
et imageCollection.filterBounds()
. Pour le filtrage à usage général, utilisez imageCollection.filter()
avec un ee.Filter
comme argument. L'exemple suivant illustre à la fois les méthodes pratiques et filter()
pour identifier et supprimer les images présentant une couverture nuageuse élevée d'un ImageCollection
.
Éditeur de code (JavaScript)
// Load Landsat 8 data, filter by date, month, and bounds.
var collection = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA')
.filterDate('2015-01-01', '2018-01-01') // Three years of data
.filter(ee.Filter.calendarRange(11, 2, 'month')) // Only Nov-Feb observations
.filterBounds(ee.Geometry.Point(25.8544, -18.08874)); // Intersecting ROI
// Also filter the collection by the CLOUD_COVER property.
var filtered = collection.filter(ee.Filter.eq('CLOUD_COVER', 0));
// Create two composites to check the effect of filtering by CLOUD_COVER.
var badComposite = collection.mean();
var goodComposite = filtered.mean();
// Display the composites.
Map.setCenter(25.8544, -18.08874, 13);
Map.addLayer(badComposite,
{bands: ['B3', 'B2', 'B1'], min: 0.05, max: 0.35, gamma: 1.1},
'Bad composite');
Map.addLayer(goodComposite,
{bands: ['B3', 'B2', 'B1'], min: 0.05, max: 0.35, gamma: 1.1},
'Good composite');
Configuration de Python
Consultez la page
Environnement Python pour en savoir plus sur l'API Python et l'utilisation de geemap
pour le développement interactif.
import ee
import geemap.core as geemap
Colab (Python)
# Load Landsat 8 data, filter by date, month, and bounds.
collection = (
ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA')
# Three years of data
.filterDate('2015-01-01', '2018-01-01')
# Only Nov-Feb observations
.filter(ee.Filter.calendarRange(11, 2, 'month'))
# Intersecting ROI
.filterBounds(ee.Geometry.Point(25.8544, -18.08874))
)
# Also filter the collection by the CLOUD_COVER property.
filtered = collection.filter(ee.Filter.eq('CLOUD_COVER', 0))
# Create two composites to check the effect of filtering by CLOUD_COVER.
bad_composite = collection.mean()
good_composite = filtered.mean()
# Display the composites.
m = geemap.Map()
m.set_center(25.8544, -18.08874, 13)
m.add_layer(
bad_composite,
{'bands': ['B3', 'B2', 'B1'], 'min': 0.05, 'max': 0.35, 'gamma': 1.1},
'Bad composite',
)
m.add_layer(
good_composite,
{'bands': ['B3', 'B2', 'B1'], 'min': 0.05, 'max': 0.35, 'gamma': 1.1},
'Good composite',
)
m
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/07/25 (UTC).
[null,null,["Dernière mise à jour le 2025/07/25 (UTC)."],[[["\u003cp\u003eEarth Engine provides multiple methods for filtering image collections, including convenience functions like \u003ccode\u003efilterDate()\u003c/code\u003e and \u003ccode\u003efilterBounds()\u003c/code\u003e as well as the more general \u003ccode\u003efilter()\u003c/code\u003e method for custom filtering needs.\u003c/p\u003e\n"],["\u003cp\u003eThis example demonstrates how to filter a Landsat 8 image collection by date, month, geographic bounds, and cloud cover using these methods.\u003c/p\u003e\n"],["\u003cp\u003eFiltering by cloud cover significantly improves the quality of composites derived from image collections, as shown by comparing a composite generated from unfiltered data with one generated from data filtered for zero cloud cover.\u003c/p\u003e\n"],["\u003cp\u003eThe code example is provided in both JavaScript and Python, enabling users to apply these filtering techniques in their preferred programming environment within the Earth Engine platform.\u003c/p\u003e\n"]]],["The content demonstrates filtering image collections in Earth Engine. It uses `filterDate()`, `filterBounds()`, and `filter()` to refine a Landsat 8 dataset. The data is filtered by date (2015-2018), month (November-February), and a specific location. Further filtering removes images with high cloud cover using `CLOUD_COVER`. Two composites, one filtered for low cloud cover and one unfiltered, are then created and displayed to illustrate the effect of filtering.\n"],null,["# Filtering an ImageCollection\n\nAs illustrated in the [Get Started section](/earth-engine/guides/getstarted)\nand the [ImageCollection Information section](/earth-engine/guides/ic_info), Earth\nEngine provides a variety of convenience methods for filtering image collections.\nSpecifically, many common use cases are handled by `imageCollection.filterDate()`,\nand `imageCollection.filterBounds()`. For general purpose filtering, use\n`imageCollection.filter()` with an `ee.Filter` as an argument. The\nfollowing example demonstrates both convenience methods and `filter()`\nto identify and remove images with high cloud cover from an `ImageCollection`.\n\n### Code Editor (JavaScript)\n\n```javascript\n// Load Landsat 8 data, filter by date, month, and bounds.\nvar collection = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA')\n .filterDate('2015-01-01', '2018-01-01') // Three years of data\n .filter(ee.Filter.calendarRange(11, 2, 'month')) // Only Nov-Feb observations\n .filterBounds(ee.Geometry.Point(25.8544, -18.08874)); // Intersecting ROI\n\n// Also filter the collection by the CLOUD_COVER property.\nvar filtered = collection.filter(ee.Filter.eq('CLOUD_COVER', 0));\n\n// Create two composites to check the effect of filtering by CLOUD_COVER.\nvar badComposite = collection.mean();\nvar goodComposite = filtered.mean();\n\n// Display the composites.\nMap.setCenter(25.8544, -18.08874, 13);\nMap.addLayer(badComposite,\n {bands: ['B3', 'B2', 'B1'], min: 0.05, max: 0.35, gamma: 1.1},\n 'Bad composite');\nMap.addLayer(goodComposite,\n {bands: ['B3', 'B2', 'B1'], min: 0.05, max: 0.35, gamma: 1.1},\n 'Good composite');\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\n# Load Landsat 8 data, filter by date, month, and bounds.\ncollection = (\n ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA')\n # Three years of data\n .filterDate('2015-01-01', '2018-01-01')\n # Only Nov-Feb observations\n .filter(ee.Filter.calendarRange(11, 2, 'month'))\n # Intersecting ROI\n .filterBounds(ee.Geometry.Point(25.8544, -18.08874))\n)\n\n# Also filter the collection by the CLOUD_COVER property.\nfiltered = collection.filter(ee.Filter.eq('CLOUD_COVER', 0))\n\n# Create two composites to check the effect of filtering by CLOUD_COVER.\nbad_composite = collection.mean()\ngood_composite = filtered.mean()\n\n# Display the composites.\nm = geemap.Map()\nm.set_center(25.8544, -18.08874, 13)\nm.add_layer(\n bad_composite,\n {'bands': ['B3', 'B2', 'B1'], 'min': 0.05, 'max': 0.35, 'gamma': 1.1},\n 'Bad composite',\n)\nm.add_layer(\n good_composite,\n {'bands': ['B3', 'B2', 'B1'], 'min': 0.05, 'max': 0.35, 'gamma': 1.1},\n 'Good composite',\n)\nm\n```"]]