ee.FeatureCollection.filter
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Zastosuj filtr do tej kolekcji.
Zwraca przefiltrowaną kolekcję.
Wykorzystanie | Zwroty |
---|
FeatureCollection.filter(filter) | Kolekcja |
Argument | Typ | Szczegóły |
---|
to: collection | Kolekcja | Instancja kolekcji. |
filter | Filtr | Filtr, który ma zostać zastosowany do tej kolekcji. |
Przykłady
Edytor kodu (JavaScript)
// 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');
Konfiguracja Pythona
Informacje o interfejsie Python API i używaniu geemap
do interaktywnego programowania znajdziesz na stronie
Środowisko Python.
import ee
import geemap.core as geemap
Colab (Python)
# 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
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-26 UTC.
[null,null,["Ostatnia aktualizacja: 2025-07-26 UTC."],[[["\u003cp\u003e\u003ccode\u003efilter()\u003c/code\u003e returns a filtered version of the original Earth Engine FeatureCollection based on the provided filter criteria.\u003c/p\u003e\n"],["\u003cp\u003eThe filter can be specified using a string expression (e.g., "ADM2_NAME == 'Denver'") or an \u003ccode\u003eee.Filter\u003c/code\u003e object (e.g., \u003ccode\u003eee.Filter.eq('ADM2_NAME', 'Denver')\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eThis method allows for the selection of specific features within a collection based on their properties.\u003c/p\u003e\n"],["\u003cp\u003eThe examples demonstrate how to filter a FeatureCollection to obtain a specific feature's geometry (Denver county) and display it on a map.\u003c/p\u003e\n"]]],["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"],null,["# ee.FeatureCollection.filter\n\n\u003cbr /\u003e\n\nApply a filter to this collection.\n\n\u003cbr /\u003e\n\nReturns the filtered collection.\n\n| Usage | Returns |\n|------------------------------------|------------|\n| FeatureCollection.filter`(filter)` | Collection |\n\n| Argument | Type | Details |\n|--------------------|------------|---------------------------------------|\n| this: `collection` | Collection | The Collection instance. |\n| `filter` | Filter | A filter to apply to this collection. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// Get Denver county polygon.\nvar denver = ee.FeatureCollection('FAO/GAUL_SIMPLIFIED_500m/2015/level2')\n .filter(\"ADM2_NAME == 'Denver'\")\n .filter(ee.Filter.eq('ADM2_NAME', 'Denver')) // Exactly the same as above.\n .first()\n .geometry();\n\nMap.centerObject(denver, 9);\nMap.addLayer(denver, null, 'Denver');\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# Get Denver county polygon.\ndenver = (\n ee.FeatureCollection('FAO/GAUL_SIMPLIFIED_500m/2015/level2')\n .filter(\"ADM2_NAME == 'Denver'\")\n .filter(ee.Filter.eq('ADM2_NAME', 'Denver')) # Exactly the same as above.\n .first()\n .geometry()\n)\n\nm = geemap.Map()\nm.center_object(denver, 9)\nm.add_layer(denver, None, 'Denver')\nm\n```"]]