お知らせ:
2025 年 4 月 15 日より前に Earth Engine の使用を登録したすべての非商用プロジェクトは、アクセスを維持するために
非商用目的での利用資格を確認する必要があります。2025 年 9 月 26 日までに確認が完了していない場合、アクセスが保留されることがあります。
ee.Number.format
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
printf 形式の書式設定を使用して数値を文字列に変換します。
用途 | 戻り値 |
---|
Number.format(pattern) | 文字列 |
引数 | タイプ | 詳細 |
---|
これ: number | 数値 | 文字列に変換する数値。 |
pattern | 文字列、デフォルト: "%s" | printf スタイルの書式文字列。たとえば、'%.2f' は '3.14' のような形式の数値を生成し、'%05d' は '00042' のような形式の数値を生成します。フォーマット文字列は次の条件を満たしている必要があります。
- 0 個以上の接頭辞文字。
- '%' が 1 つだけ。
- セット [#-+ 0,(.\d] 内の 0 個以上の修飾子文字。
- セット [sdoxXeEfgGaA] の変換文字が 1 つだけ。
- 0 個以上の接尾辞文字。
形式文字列の詳細については、https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Formatter.html をご覧ください。 |
例
コードエディタ(JavaScript)
print('Zero-fill to length of 3',
ee.Number(1).format('%03d')); // 001
print('Include 1 decimal place in 1.2347',
ee.Number(1.23476).format('%.1f')); // 1.2
print('Include 3 decimal places in 1.2347',
ee.Number(1.23476).format('%.3f')); // 1.235 (rounds up)
print('Scientific notation with 3 decimal places shown',
ee.Number(123476).format('%.3e')); // 1.235e+05 (rounds up)
print('Integer with 2 decimal places of precision',
ee.Number(123476).format('%.2f')); // 123476.00
Python の設定
Python API とインタラクティブな開発での geemap
の使用については、
Python 環境のページをご覧ください。
import ee
import geemap.core as geemap
Colab(Python)
print('Zero-fill to length of 3:',
ee.Number(1).format('%03d').getInfo()) # 001
print('Include 1 decimal place in 1.2347:',
ee.Number(1.23476).format('%.1f').getInfo()) # 1.2
print('Include 3 decimal places in 1.2347:',
ee.Number(1.23476).format('%.3f').getInfo()) # 1.235 (rounds up)
print('Scientific notation with 3 decimal places shown:',
ee.Number(123476).format('%.3e').getInfo()) # 1.235e+05 (rounds up)
print('Integer with 2 decimal places of precision:',
ee.Number(123476).format('%.2f').getInfo()) # 123476.00
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-26 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-26 UTC。"],[],[]]