ee.Feature

Le funzionalità possono essere create da uno dei seguenti argomenti più un dizionario facoltativo di proprietà:

  - Un ee.Geometry.

  - Una geometria GeoJSON.

  - Una funzionalità GeoJSON.

  - Un oggetto calcolato: reinterpretato come geometria se vengono specificate le proprietà e come funzionalità in caso contrario.

UtilizzoResi
ee.Feature(geometry, properties)Funzionalità
ArgomentoTipoDettagli
geometryComputedObject|Feature|Geometry|ObjectUna geometria o una funzionalità.
propertiesOggetto, facoltativoUn dizionario di proprietà dei metadati. Se il primo parametro è una funzionalità (anziché una geometria), questo non viene utilizzato.

Esempi

Editor di codice (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);

Configurazione di Python

Consulta la pagina Ambiente Python per informazioni sull'API Python e sull'utilizzo di geemap per lo sviluppo interattivo.

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