Earth Engine 推出了
非商业配额层级,以保护共享计算资源并确保为所有人提供可靠的性能。非商业项目默认使用 Community
层级,但您可以随时更改项目的层级。
Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
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
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2026-06-17。
[null,null,["最后更新时间 (UTC):2026-06-17。"],[],["The content details how to apply a filter to a `FeatureCollection`, which returns a filtered collection. The `filter` argument, of type `Filter`, is applied to the `Collection` instance. Examples in JavaScript and Python demonstrate filtering a collection to find the 'Denver' county polygon using `.filter()`. This filtering can be done directly using the parameter name and value or using `ee.Filter.eq()` and is applied to the \"ADM2_NAME\" parameter.\n"]]