ee.Feature
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Features können aus einem der folgenden Argumente sowie einem optionalen Attribut-Dictionary erstellt werden:
– Eine ee.Geometry.
– Eine GeoJSON-Geometrie.
– Ein GeoJSON-Feature.
– Ein berechnetes Objekt: wird als Geometrie neu interpretiert, wenn Attribute angegeben sind, und als Feature, wenn nicht.
Nutzung | Ausgabe |
---|
ee.Feature(geometry, properties) | Funktion |
Argument | Typ | Details |
---|
geometry | ComputedObject|Feature|Geometry|Object | Eine Geometrie oder ein Attribut. |
properties | Objekt, optional | Ein Dictionary mit Metadateneigenschaften. Wenn der erste Parameter ein Feature (anstatt einer Geometrie) ist, wird er nicht verwendet. |
Beispiele
Code-Editor (JavaScript)
// Create the simplest possible feature.
print(ee.Feature(null)); // Empty feature
// Demonstrate how to set a feature's id.
print(ee.Feature(null, {'id': 'yada'}).id()); // null
print(ee.Feature(null, {'system:index': 'abc123'}).id()); // abc123
// The simplest possible feature with a geometry.
var feature = ee.Feature(ee.Geometry.Point([-114.318, 38.985]));
Map.addLayer(feature);
Map.centerObject(feature, 10);
Python einrichten
Informationen zur Python API und zur Verwendung von geemap
für die interaktive Entwicklung finden Sie auf der Seite
Python-Umgebung.
import ee
import geemap.core as geemap
Colab (Python)
# Create the simplest possible feature.
display(ee.Feature(None)) # Empty feature
# Demonstrate how to set a feature's id.
display(ee.Feature(None, {'id': 'yada'}).id()) # None
display(ee.Feature(None, {'system:index': 'abc123'}).id()) # abc123
# The simplest possible feature with a geometry.
feature = ee.Feature(ee.Geometry.Point([-114.318, 38.985]))
m = geemap.Map()
m.add_layer(feature)
m.center_object(feature, 10)
m
Sofern nicht anders angegeben, sind die Inhalte dieser Seite unter der Creative Commons Attribution 4.0 License und Codebeispiele unter der Apache 2.0 License lizenziert. Weitere Informationen finden Sie in den Websiterichtlinien von Google Developers. Java ist eine eingetragene Marke von Oracle und/oder seinen Partnern.
Zuletzt aktualisiert: 2025-07-26 (UTC).
[null,null,["Zuletzt aktualisiert: 2025-07-26 (UTC)."],[[["\u003cp\u003e\u003ccode\u003eee.Feature\u003c/code\u003e objects represent geographic features with geometry and properties, and can be constructed from geometries, GeoJSON, or computed objects.\u003c/p\u003e\n"],["\u003cp\u003eFeatures can have an optional dictionary of properties to store metadata.\u003c/p\u003e\n"],["\u003cp\u003eFeature IDs are determined by the \u003ccode\u003esystem:index\u003c/code\u003e property, if present, or by the \u003ccode\u003eid\u003c/code\u003e property as a fallback.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eee.Feature\u003c/code\u003e constructor provides a flexible way to create features with or without geometries and associated properties within Earth Engine.\u003c/p\u003e\n"],["\u003cp\u003eSimple features can be visualized on a map using \u003ccode\u003eMap.addLayer\u003c/code\u003e and \u003ccode\u003eMap.centerObject\u003c/code\u003e in JavaScript or similar functions in Python using \u003ccode\u003egeemap\u003c/code\u003e.\u003c/p\u003e\n"]]],["Features are created using a geometry (ee.Geometry, GeoJSON Geometry, or GeoJSON Feature) or a computed object, along with an optional dictionary of properties. `ee.Feature(geometry, properties)` creates a Feature. The `geometry` argument can be a geometry or another feature. The optional `properties` argument is a metadata dictionary; it's unused if the first argument is already a feature. A feature can be created without a geometry and an `id` or a `system:index` can be set.\n"],null,["# ee.Feature\n\n\u003cbr /\u003e\n\nFeatures can be constructed from one of the following arguments plus an optional dictionary of properties:\n\n\u003cbr /\u003e\n\n- An ee.Geometry.\n\n- A GeoJSON Geometry.\n\n- A GeoJSON Feature.\n\n- A computed object: reinterpreted as a geometry if properties are specified, and as a feature if they aren't.\n\n| Usage | Returns |\n|----------------------------------------|---------|\n| `ee.Feature(geometry, `*properties*`)` | Feature |\n\n| Argument | Type | Details |\n|--------------|-------------------------------------------|-------------------------------------------------------------------------------------------------------------------|\n| `geometry` | ComputedObject\\|Feature\\|Geometry\\|Object | A geometry or feature. |\n| `properties` | Object, optional | A dictionary of metadata properties. If the first parameter is a Feature (instead of a geometry), this is unused. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// Create the simplest possible feature.\nprint(ee.Feature(null)); // Empty feature\n\n// Demonstrate how to set a feature's id.\nprint(ee.Feature(null, {'id': 'yada'}).id()); // null\nprint(ee.Feature(null, {'system:index': 'abc123'}).id()); // abc123\n\n// The simplest possible feature with a geometry.\nvar feature = ee.Feature(ee.Geometry.Point([-114.318, 38.985]));\nMap.addLayer(feature);\nMap.centerObject(feature, 10);\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# Create the simplest possible feature.\ndisplay(ee.Feature(None)) # Empty feature\n\n# Demonstrate how to set a feature's id.\ndisplay(ee.Feature(None, {'id': 'yada'}).id()) # None\ndisplay(ee.Feature(None, {'system:index': 'abc123'}).id()) # abc123\n\n# The simplest possible feature with a geometry.\nfeature = ee.Feature(ee.Geometry.Point([-114.318, 38.985]))\nm = geemap.Map()\nm.add_layer(feature)\nm.center_object(feature, 10)\nm\n```"]]