お知らせ:
2025 年 4 月 15 日より前に Earth Engine の使用を登録したすべての非商用プロジェクトは、Earth Engine へのアクセスを維持するために
非商用目的での利用資格を確認する必要があります。
ee.Number.parse
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
文字列を数値に変換します。
用途 | 戻り値 |
---|
ee.Number.parse(input, radix) | 数値 |
引数 | タイプ | 詳細 |
---|
input | 文字列 | 数値に変換する文字列。 |
radix | 整数、デフォルト: 10 | 変換元の基数を表す整数。入力が整数でない場合、基数は 10 にするか、指定しない必要があります。 |
例
コードエディタ(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 の設定
Python API とインタラクティブな開発での geemap
の使用については、
Python 環境のページをご覧ください。
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
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-26 UTC。
[null,null,["最終更新日 2025-07-26 UTC。"],[[["\u003cp\u003e\u003ccode\u003eee.Number.parse()\u003c/code\u003e converts a string to an Earth Engine Number object.\u003c/p\u003e\n"],["\u003cp\u003eThe function accepts an optional \u003ccode\u003eradix\u003c/code\u003e argument for specifying the base of the number system (default is 10).\u003c/p\u003e\n"],["\u003cp\u003eLeading zeros in the input string are automatically removed during conversion.\u003c/p\u003e\n"],["\u003cp\u003eThe function can handle various input types like client-side strings, Earth Engine Strings, and values retrieved from Earth Engine features.\u003c/p\u003e\n"]]],["`ee.Number.parse()` converts a string to a number. It accepts a string `input` and an optional `radix` (default 10), representing the base of the number system. If the input isn't an integer, radix must be 10 or unspecified. Leading zeros are removed during conversion. The examples show parsing client-side strings, `ee.String` objects, and ambiguous objects, both in JavaScript and Python. Base 16 conversions using radix are also shown.\n"],null,["# ee.Number.parse\n\nConvert a string to a number.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-------------------------------------|---------|\n| `ee.Number.parse(input, `*radix*`)` | Number |\n\n| Argument | Type | Details |\n|----------|----------------------|--------------------------------------------------------------------------------------------------------------------------------------------|\n| `input` | String | The string to convert to a number. |\n| `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. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\nprint('Client-side string converted to ee.Number',\n ee.Number.parse('10')); // 10\n\nprint('ee.String converted to ee.Number',\n ee.Number.parse(ee.String('100'))); // 100\n\nprint('Ambiguous string object converted to ee.Number',\n ee.Number.parse(ee.Feature(null, {id: '1000'}).get('id'))); // 1000\n\nprint('Ambiguous number object converted to ee.Number',\n ee.Number.parse(ee.Feature(null, {id: 1000}).get('id'))); // 1000\n\nprint('Leading zeros are removed',\n ee.Number.parse('0001')); // 1\n\nprint('Radix 16',\n ee.Number.parse('3E8', 16)); // 1000\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\nprint('Client-side string converted to ee.Number:',\n ee.Number.parse('10').getInfo()) # 10\n\nprint('ee.String converted to ee.Number:',\n ee.Number.parse(ee.String('100')).getInfo()) # 100\n\n# 1000\nprint('Ambiguous string object converted to ee.Number:',\n ee.Number.parse(ee.Feature(None, {'id': '1000'}).get('id')).getInfo())\n\nprint('Leading zeros are removed:',\n ee.Number.parse('0001').getInfo()) # 1\n\nprint('Radix 16:', ee.Number.parse('3E8', 16).getInfo()) # 1000\n```"]]