Anuncio: Todos los proyectos no comerciales registrados para usar Earth Engine antes del
15 de abril de 2025 deben
verificar su elegibilidad no comercial para mantener el acceso a Earth Engine.
ee.Feature
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Las funciones se pueden construir a partir de uno de los siguientes argumentos, además de un diccionario opcional de propiedades:
- Un ee.Geometry.
- Una geometría GeoJSON
- Un objeto Feature de GeoJSON
- Un objeto calculado: Se reinterpreta como una geometría si se especifican propiedades y como una función si no se especifican.
Uso | Muestra |
---|
ee.Feature(geometry, properties) | Función |
Argumento | Tipo | Detalles |
---|
geometry | ComputedObject|Feature|Geometry|Object | Es una geometría o un componente. |
properties | Objeto, opcional | Es un diccionario de propiedades de metadatos. Si el primer parámetro es un Feature (en lugar de una geometría), no se usa. |
Ejemplos
Editor de código (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);
Configuración de Python
Consulta la página
Entorno de Python para obtener información sobre la API de Python y el uso de geemap
para el desarrollo interactivo.
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
Salvo que se indique lo contrario, el contenido de esta página está sujeto a la licencia Atribución 4.0 de Creative Commons, y los ejemplos de código están sujetos a la licencia Apache 2.0. Para obtener más información, consulta las políticas del sitio de Google Developers. Java es una marca registrada de Oracle o sus afiliados.
Última actualización: 2025-07-26 (UTC)
[null,null,["Última actualización: 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```"]]