公告:所有在
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 API 和如何使用 geemap
进行交互式开发,请参阅
Python 环境页面。
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
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):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```"]]