ee.FeatureCollection.toDictionary

  • The toDictionary() method extracts properties from a Feature as a dictionary.

  • The method can extract all non-system properties or a specified list of properties.

  • Usage examples are provided for both JavaScript in the Code Editor and Python in Colab.

Extract properties from a feature as a dictionary.

UsageReturns
FeatureCollection.toDictionary(properties)Dictionary
ArgumentTypeDetails
this: elementElementThe feature to extract the property from.
propertiesList, default: nullThe list of properties to extract. Defaults to all non-system properties.

Examples

Code Editor (JavaScript)

// FeatureCollection of power plants.
var fc = ee.FeatureCollection('WRI/GPPD/power_plants');

print('All non-system FeatureCollection properties as an ee.Dictionary',
      fc.toDictionary());
print('Selected properties as an ee.Dictionary',
      fc.toDictionary(['description', 'provider']));

Python setup

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

import ee
import geemap.core as geemap

Colab (Python)

# FeatureCollection of power plants.
fc = ee.FeatureCollection('WRI/GPPD/power_plants')

print('All non-system FeatureCollection properties as an ee.Dictionary:',
      fc.toDictionary().getInfo())
print('Selected properties as an ee.Dictionary:',
      fc.toDictionary(['description', 'provider']).getInfo())