Announcement: All noncommercial projects registered to use Earth Engine beforeApril 15, 2025 mustverify noncommercial eligibility to maintain access. If you have not verified by September 26, 2025, your access may be on hold.

ee.Feature

  • Features can be constructed from an ee.Geometry, a GeoJSON Geometry, a GeoJSON Feature, or a computed object.

  • An optional dictionary of properties can be included when constructing a Feature.

  • Theee.Feature(geometry, properties) usage returns a Feature object.

  • Examples demonstrate creating simple and empty features in JavaScript and Python, as well as setting a feature's ID and adding a feature with geometry to a map.

Features can be constructed from one of the following arguments plus an optional dictionary of properties:

  - An ee.Geometry.

  - A GeoJSON Geometry.

  - A GeoJSON Feature.

  - A computed object: reinterpreted as a geometry if properties are specified, and as a feature if they aren't.

UsageReturns
ee.Feature(geometry,properties)Feature
ArgumentTypeDetails
geometryComputedObject|Feature|Geometry|ObjectA geometry or feature.
propertiesObject, optionalA dictionary of metadata properties. If the first parameter is a Feature (instead of a geometry), this is unused.

Examples

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());// nullprint(ee.Feature(null,{'system:index':'abc123'}).id());// abc123// The simplest possible feature with a geometry.varfeature=ee.Feature(ee.Geometry.Point([-114.318,38.985]));Map.addLayer(feature);Map.centerObject(feature,10);

Python setup

See the Python Environment page for information on the Python API and usinggeemap for interactive development.

importeeimportgeemap.coreasgeemap

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())# Nonedisplay(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

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2023-10-06 UTC.