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.Number.parse Stay organized with collections Save and categorize content based on your preferences.
Page Summary
Use
ee.Number.parse(input, radix)to convert a string to anee.Number.The
inputargument is the string to convert, and the optionalradixargument specifies the base number system, defaulting to 10.Leading zeros are removed during the conversion process.
| Usage | Returns |
|---|---|
ee.Number.parse(input,radix) | Number |
| Argument | Type | Details |
|---|---|---|
input | String | The string to convert to a number. |
radix | Integer, default: 10 | An integer representing the base number system from which to convert. If input is not an integer, radix must equal 10 or not be specified. |
Examples
Code Editor (JavaScript)
print('Client-side string converted to ee.Number',ee.Number.parse('10'));// 10print('ee.String converted to ee.Number',ee.Number.parse(ee.String('100')));// 100print('Ambiguous string object converted to ee.Number',ee.Number.parse(ee.Feature(null,{id:'1000'}).get('id')));// 1000print('Ambiguous number object converted to ee.Number',ee.Number.parse(ee.Feature(null,{id:1000}).get('id')));// 1000print('Leading zeros are removed',ee.Number.parse('0001'));// 1print('Radix 16',ee.Number.parse('3E8',16));// 1000
Python setup
See the Python Environment page for information on the Python API and usinggeemap for interactive development.
importeeimportgeemap.coreasgeemap
Colab (Python)
display('Client-side string converted to ee.Number:',ee.Number.parse('10'))# 10display('ee.String converted to ee.Number:',ee.Number.parse(ee.String('100')))# 100# 1000display('Ambiguous string object converted to ee.Number:',ee.Number.parse(ee.Feature(None,{'id':'1000'}).get('id')))display('Leading zeros are removed:',ee.Number.parse('0001'))# 1display('Radix 16:',ee.Number.parse('3E8',16))# 1000
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.