ee.FeatureCollection.filter

对此集合应用过滤条件。

返回过滤后的集合。

用法返回
FeatureCollection.filter(filter)集合
参数类型详细信息
此:collection集合Collection 实例。
filter过滤要应用于相应集合的过滤条件。

示例

代码编辑器 (JavaScript)

// Load a collection of counties.
var counties = ee.FeatureCollection('FAO/GAUL_SIMPLIFIED_500m/2015/level2');

// Filter the collection to get Denver county.
var denverCollection = counties.filter(ee.Filter.eq('ADM2_NAME', 'Denver'));

// Or you can use a string filter (equivalent to the above):
// var denverCollection = counties.filter("ADM2_NAME == 'Denver'");

Map.centerObject(denverCollection, 9);
Map.addLayer(denverCollection, null, 'Denver');

Python 设置

如需了解 Python API 和如何使用 geemap 进行交互式开发,请参阅 Python 环境页面。

import ee
import geemap.core as geemap

Colab (Python)

# Load a collection of counties.
counties = ee.FeatureCollection('FAO/GAUL_SIMPLIFIED_500m/2015/level2')

# Filter the collection to get Denver county.
denver_collection = counties.filter(ee.Filter.eq('ADM2_NAME', 'Denver'))

# Or you can use a string filter (equivalent to the above):
# denver_collection = counties.filter("ADM2_NAME == 'Denver'")

m = geemap.Map()
m.center_object(denver_collection, 9)
m.add_layer(denver_collection, None, 'Denver')
m