ee.FeatureCollection.filter
Apply a filter to this collection.
Returns the filtered collection.
Usage | Returns |
---|
FeatureCollection.filter(filter) | Collection |
Argument | Type | Details |
---|
this: collection | Collection | The Collection instance. |
filter | Filter | A filter to apply to this collection. |
Examples
// Get Denver county polygon.
var denver = ee.FeatureCollection('FAO/GAUL_SIMPLIFIED_500m/2015/level2')
.filter("ADM2_NAME == 'Denver'")
.filter(ee.Filter.eq('ADM2_NAME', 'Denver')) // Exactly the same as above.
.first()
.geometry();
Map.centerObject(denver, 9);
Map.addLayer(denver, null, 'Denver');
Python setup
See the
Python Environment page for information on the Python API and using
geemap
for interactive development.
import ee
import geemap.core as geemap
# Get Denver county polygon.
denver = (
ee.FeatureCollection('FAO/GAUL_SIMPLIFIED_500m/2015/level2')
.filter("ADM2_NAME == 'Denver'")
.filter(ee.Filter.eq('ADM2_NAME', 'Denver')) # Exactly the same as above.
.first()
.geometry()
)
m = geemap.Map()
m.center_object(denver, 9)
m.add_layer(denver, None, 'Denver')
m
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[[["`filter()` returns a filtered version of the original Earth Engine FeatureCollection based on the provided filter criteria."],["The filter can be specified using a string expression (e.g., \"ADM2_NAME == 'Denver'\") or an `ee.Filter` object (e.g., `ee.Filter.eq('ADM2_NAME', 'Denver')`)."],["This method allows for the selection of specific features within a collection based on their properties."],["The examples demonstrate how to filter a FeatureCollection to obtain a specific feature's geometry (Denver county) and display it on a map."]]],["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"]]