ee.Number.parse
Stay organized with collections
Save and categorize content based on your preferences.
Convert a string to a number.
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')); // 10
print('ee.String converted to ee.Number',
ee.Number.parse(ee.String('100'))); // 100
print('Ambiguous string object converted to ee.Number',
ee.Number.parse(ee.Feature(null, {id: '1000'}).get('id'))); // 1000
print('Ambiguous number object converted to ee.Number',
ee.Number.parse(ee.Feature(null, {id: 1000}).get('id'))); // 1000
print('Leading zeros are removed',
ee.Number.parse('0001')); // 1
print('Radix 16',
ee.Number.parse('3E8', 16)); // 1000
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)
print('Client-side string converted to ee.Number:',
ee.Number.parse('10').getInfo()) # 10
print('ee.String converted to ee.Number:',
ee.Number.parse(ee.String('100')).getInfo()) # 100
# 1000
print('Ambiguous string object converted to ee.Number:',
ee.Number.parse(ee.Feature(None, {'id': '1000'}).get('id')).getInfo())
print('Leading zeros are removed:',
ee.Number.parse('0001').getInfo()) # 1
print('Radix 16:', ee.Number.parse('3E8', 16).getInfo()) # 1000
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]