ee.FeatureCollection.getNumber Stay organized with collections Save and categorize content based on your preferences.
Page Summary
Learn how to extract a numerical property from a FeatureCollection using the
getNumbermethod.The
getNumbermethod takes the property name as a string and returns anee.Numberobject in JavaScript or requires.getInfo()in Python for a standard number.Examples in both JavaScript and Python demonstrate how to apply
getNumberto retrieve a specific number property from a FeatureCollection.
| Usage | Returns |
|---|---|
FeatureCollection.getNumber(property) | Number |
| Argument | Type | Details |
|---|---|---|
this:object | Element | The feature to extract the property from. |
property | String | The property to extract. |
Examples
Code Editor (JavaScript)
// A FeatureCollection with a number property value.varfc=ee.FeatureCollection([]).set('number_property',1.5);// Fetch the number property value as an ee.Number object.print('Number property value as ee.Number',fc.getNumber('number_property'));
Python setup
See the Python Environment page for information on the Python API and usinggeemap for interactive development.
importeeimportgeemap.coreasgeemap
Colab (Python)
# A FeatureCollection with a number property value.fc=ee.FeatureCollection([]).set('number_property',1.5)# Fetch the number property value as an ee.Number object.display('Number property value as ee.Number:',fc.getNumber('number_property'))
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.