公告:凡是在
2025 年 4 月 15 日前註冊使用 Earth Engine 的非商業專案,都必須
驗證非商業用途資格,才能繼續存取 Earth Engine。
print
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
將引數列印到控制台。
引數 | 類型 | 詳細資料 |
---|
var_args | VarArgs<Object> | 要列印的物件。 |
範例
程式碼編輯器 (JavaScript)
print(1); // 1
print(ee.Number(1)); // 1
print(ee.Array([1])); // [1]
print(ee.ImageCollection('AAFC/ACI').size()); // 10
print(ee.Image('AAFC/ACI/2009')); // Image AAFC/ACI/2009 (1 band)
print(ee.FeatureCollection("NOAA/NHC/HURDAT2/pacific").size()); // 28547
Python 設定
請參閱
Python 環境頁面,瞭解 Python API 和如何使用 geemap
進行互動式開發。
import ee
import geemap.core as geemap
Colab (Python)
"""There is no dedicated print function for the Earth Engine Python API.
To print Earth Engine objects, use Python's built-in `print` function.
Printing an Earth Engine object in Python prints the serialized request for the
object, not the object itself, so you must call `getInfo()` on Earth Engine
objects to get the desired object from the server to the client. For example,
`print(ee.Number(1).getInfo())`. Note that `getInfo()` is a synchronous
operation. Alternatively, the eerepr library provides rich Earth Engine object
representation; it is included in the geemap library.
"""
print(1) # 1
print(ee.Number(1).getInfo()) # 1
print(ee.Array([1]).getInfo()) # [1]
print(ee.ImageCollection('AAFC/ACI').size().getInfo()) # 10
print(ee.Image('AAFC/ACI/2009').getInfo()) # Image AAFC/ACI/2009 (1 band)
print(
ee.FeatureCollection("NOAA/NHC/HURDAT2/pacific").size().getInfo()
) # 28547
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[[["\u003cp\u003e\u003ccode\u003eprint()\u003c/code\u003e displays the provided arguments, including Earth Engine objects and standard data types, in the console.\u003c/p\u003e\n"],["\u003cp\u003eIn JavaScript, \u003ccode\u003eprint()\u003c/code\u003e directly displays Earth Engine objects, while in Python, you typically need to use \u003ccode\u003egetInfo()\u003c/code\u003e or the \u003ccode\u003eeerepr\u003c/code\u003e library for proper visualization.\u003c/p\u003e\n"],["\u003cp\u003eThe function accepts a variable number of arguments (\u003ccode\u003evar_args\u003c/code\u003e) representing the objects to be printed.\u003c/p\u003e\n"],["\u003cp\u003eExamples are provided demonstrating the usage of \u003ccode\u003eprint()\u003c/code\u003e with various Earth Engine objects like \u003ccode\u003eee.Number\u003c/code\u003e, \u003ccode\u003eee.Array\u003c/code\u003e, \u003ccode\u003eee.ImageCollection\u003c/code\u003e, and \u003ccode\u003eee.Image\u003c/code\u003e.\u003c/p\u003e\n"]]],["The `print` function displays objects to the console. It accepts `VarArgs` as input. In JavaScript, `print(var_args)` directly outputs the object's value. In Python, the built-in `print` displays the serialized request for Earth Engine objects. To print the object's value in Python, `.getInfo()` is needed, which synchronously retrieves the object from the server, as in `print(ee.Number(1).getInfo())`. Example cases are shown for numbers, arrays, and image collections.\n"],null,["# print\n\n\u003cbr /\u003e\n\nPrints the arguments to the console.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-------------------|---------|\n| `print(var_args)` | |\n\n| Argument | Type | Details |\n|------------|-------------------|-----------------------|\n| `var_args` | VarArgs\\\u003cObject\\\u003e | The objects to print. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\nprint(1); // 1\nprint(ee.Number(1)); // 1\nprint(ee.Array([1])); // [1]\n\nprint(ee.ImageCollection('AAFC/ACI').size()); // 10\nprint(ee.Image('AAFC/ACI/2009')); // Image AAFC/ACI/2009 (1 band)\n\nprint(ee.FeatureCollection(\"NOAA/NHC/HURDAT2/pacific\").size()); // 28547\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\n\"\"\"There is no dedicated print function for the Earth Engine Python API.\nTo print Earth Engine objects, use Python's built-in `print` function.\nPrinting an Earth Engine object in Python prints the serialized request for the\nobject, not the object itself, so you must call `getInfo()` on Earth Engine\nobjects to get the desired object from the server to the client. For example,\n`print(ee.Number(1).getInfo())`. Note that `getInfo()` is a synchronous\noperation. Alternatively, the eerepr library provides rich Earth Engine object\nrepresentation; it is included in the geemap library.\n\"\"\"\n\nprint(1) # 1\nprint(ee.Number(1).getInfo()) # 1\nprint(ee.Array([1]).getInfo()) # [1]\n\nprint(ee.ImageCollection('AAFC/ACI').size().getInfo()) # 10\nprint(ee.Image('AAFC/ACI/2009').getInfo()) # Image AAFC/ACI/2009 (1 band)\n\nprint(\n ee.FeatureCollection(\"NOAA/NHC/HURDAT2/pacific\").size().getInfo()\n) # 28547\n```"]]