ee.ImageCollection.filterBounds

可依幾何交集篩選集合的捷徑。如果集合中的項目足跡無法與指定幾何圖形相交,就會遭到排除。

這相當於 this.filter(ee.Filter.bounds(...))。

傳回經過篩選的集合。

用量傳回
ImageCollection.filterBounds(geometry)集合
引數類型詳細資料
這個:collection集合Collection 執行個體。
geometryComputedObject|FeatureCollection|Geometry要與之相交的幾何圖形、特徵或集合。

範例

程式碼編輯器 (JavaScript)

// A Sentinel-2 surface reflectance image collection for 3 months in 2021.
var ic = ee.ImageCollection('COPERNICUS/S2_SR')
             .filterDate('2021-07-01', '2021-10-01');

// A point geometry for the peak of Mount Shasta, California, USA.
var geom = ee.Geometry.Point(-122.196, 41.411);
print('Images intersecting point geometry', ic.filterBounds(geom));

// A feature collection of point geometries for mountain peaks.
var fc = ee.FeatureCollection([
  ee.Feature(ee.Geometry.Point(-122.196, 41.411), {mountain: 'Mount Shasta'}),
  ee.Feature(ee.Geometry.Point(-121.697, 45.374), {mountain: 'Mount Hood'})
]);
print('Images intersecting feature collection', ic.filterBounds(fc));

Python 設定

請參閱 Python 環境頁面,瞭解 Python API 和如何使用 geemap 進行互動式開發。

import ee
import geemap.core as geemap

Colab (Python)

# A Sentinel-2 surface reflectance image collection for 3 months in 2021.
ic = ee.ImageCollection('COPERNICUS/S2_SR').filterDate(
    '2021-07-01', '2021-10-01'
)

# A point geometry for the peak of Mount Shasta, California, USA.
geom = ee.Geometry.Point(-122.196, 41.411)
print('Images intersecting point geometry:', ic.filterBounds(geom).getInfo())

# A feature collection of point geometries for mountain peaks.
fc = ee.FeatureCollection([
    ee.Feature(ee.Geometry.Point(-122.196, 41.411),
               {'mountain': 'Mount Shasta'}),
    ee.Feature(ee.Geometry.Point(-121.697, 45.374),
               {'mountain': 'Mount Hood'})
])
print('Images intersecting feature collection:', ic.filterBounds(fc).getInfo())