公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
ee.Image
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
表示 Earth Engine 影像的对象。此构造函数可接受各种实参:
- 字符串:EarthEngine 资产 ID,
- 一个字符串和一个数字:EarthEngine 资产 ID 和版本,
- 数字或 ee.Array:创建常量映像,
- 列表:根据每个列表元素创建一张图片,并将它们合并为一张图片,
- ee.Image:返回实参,
- 无:生成一张空白透明图片。
参数 | 类型 | 详细信息 |
---|
args | Image|List<Object>|Number|Object|String,可选 | 构造函数实参。 |
示例
代码编辑器 (JavaScript)
var image = ee.Image('NASA/NASADEM_HGT/001');
Map.setZoom(3);
Map.addLayer(image.select('elevation'), {min: -1e3, max: 5e3}, 'Elevation');
// Image NASA/NASADEM_HGT/001 (3 bands)
// type: Image
// id: NASA/NASADEM_HGT/001
// version: 1641990521971299
// bands: List (3 elements)
// properties: Object (22 properties)
print(image);
var transparent = ee.Image();
Map.addLayer(transparent, null, 'transparent', false);
// Image (1 band)
// type: Image
// bands: List (1 element)
// 0: "constant", int ∈ [0, 0], EPSG:4326
print(transparent);
// Create a multi-band image from a list of constants.
var orange = ee.Image([0xff, 0x88, 0x00]);
Map.addLayer(orange, {min: 0, max: 0xff}, 'orange', false);
// Image (3 bands)
// type: Image
// bands: List (3 elements)
// 0: "constant", int ∈ [255, 255], EPSG:4326
// 1: "constant_1", int ∈ [136, 136], EPSG:4326
// 2: "constant_2", int ∈ [0, 0], EPSG:4326
print(orange);
// Create a one band image where each pixel is an array of three values.
var imageOfArray = ee.Image(ee.Array([0x00, 0x00, 0xff]));
Map.addLayer(imageOfArray, null, 'imageOfArray', false);
// Image (1 band)
// type: Image
// bands: List (1 element)
// 0: "constant", unsigned int8, 1 dimension, EPSG:4326
// id: constant
// crs: EPSG:4326
// crs_transform: [1,0,0,0,1,0]
// data_type: unsigned int8, 1 dimension
// type: PixelType
// dimensions: 1
// max: 255
// min: 0
// precision: int
print(imageOfArray);
Python 设置
如需了解 Python API 和如何使用 geemap
进行交互式开发,请参阅
Python 环境页面。
import ee
import geemap.core as geemap
Colab (Python)
image = ee.Image('NASA/NASADEM_HGT/001')
m = geemap.Map()
m.zoom = 3
display(m)
m.add_layer(image.select('elevation'), {'min': -1e3, 'max': 5e3}, 'Elevation')
# Image NASA/NASADEM_HGT/001 (3 bands)
# type: Image
# id: NASA/NASADEM_HGT/001
# version: 1641990521971299
# 'bands': List (3 elements)
# properties: Object (22 properties)
display(image)
transparent = ee.Image()
m.add_layer(transparent, None, 'transparent', False)
# Image (1 band)
# type: Image
# 'bands': List (1 element)
# 0: "constant", int ∈ [0, 0], EPSG:4326
display(transparent)
# Create a multi-band image from a list of constants.
orange = ee.Image([0xFF, 0x88, 0x00])
m.add_layer(orange, {'min': 0, 'max': 0xFF}, 'orange', False)
# Image (3 bands)
# type: Image
# 'bands': List (3 elements)
# 0: "constant", int ∈ [255, 255], EPSG:4326
# 1: "constant_1", int ∈ [136, 136], EPSG:4326
# 2: "constant_2", int ∈ [0, 0], EPSG:4326
display(orange)
# Create a one band image where each pixel is an array of three values.
image_of_array = ee.Image(ee.Array([0x00, 0x00, 0xFF]))
m.add_layer(image_of_array, None, 'image_of_array', False)
# Image (1 band)
# type: Image
# 'bands': List (1 element)
# 0: "constant", unsigned int8, 1 dimension, EPSG:4326
# id: constant
# crs: EPSG:4326
# crs_transform: [1,0,0,0,1,0]
# data_type: unsigned int8, 1 dimension
# type: PixelType
# dimensions: 1
# 'max': 255
# 'min': 0
# precision: int
display(image_of_array)
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003e\u003ccode\u003eee.Image()\u003c/code\u003e is a constructor used to create or represent Earth Engine images.\u003c/p\u003e\n"],["\u003cp\u003eIt accepts arguments such as asset IDs, constants, lists, and other images to construct an image object.\u003c/p\u003e\n"],["\u003cp\u003eWhen called with no arguments, it generates an empty, transparent image.\u003c/p\u003e\n"],["\u003cp\u003eIt enables users to create images from a variety of sources, including asset IDs, constants, lists and more, making them ready for analysis and visualization.\u003c/p\u003e\n"]]],["The core content details creating Earth Engine images using `ee.Image()`. Images can be constructed from an asset ID string, an ID and version number, a number/`ee.Array` for constant images, or a list that becomes a multi-band image. An existing `ee.Image` will return the argument, and calling with nothing results in a transparent image. Examples demonstrate loading asset images, generating constant or multi-band images, and displaying these results using code examples in Javascript and Python.\n"],null,["# ee.Image\n\n\u003cbr /\u003e\n\nAn object to represent an Earth Engine image. This constructor accepts a variety of arguments:\n\n\u003cbr /\u003e\n\n- A string: an EarthEngine asset id,\n\n- A string and a number: an EarthEngine asset id and version,\n\n- A number or ee.Array: creates a constant image,\n\n- A list: creates an image out of each list element and combines them into a single image,\n\n- An ee.Image: returns the argument,\n\n- Nothing: results in an empty transparent image.\n\n| Usage | Returns |\n|----------------------|---------|\n| `ee.Image(`*args*`)` | Image |\n\n| Argument | Type | Details |\n|----------|---------------------------------------------------------|-----------------------|\n| `args` | Image\\|List\\\u003cObject\\\u003e\\|Number\\|Object\\|String, optional | Constructor argument. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\nvar image = ee.Image('NASA/NASADEM_HGT/001');\n\nMap.setZoom(3);\nMap.addLayer(image.select('elevation'), {min: -1e3, max: 5e3}, 'Elevation');\n// Image NASA/NASADEM_HGT/001 (3 bands)\n// type: Image\n// id: NASA/NASADEM_HGT/001\n// version: 1641990521971299\n// bands: List (3 elements)\n// properties: Object (22 properties)\nprint(image);\n\nvar transparent = ee.Image();\nMap.addLayer(transparent, null, 'transparent', false);\n// Image (1 band)\n// type: Image\n// bands: List (1 element)\n// 0: \"constant\", int ∈ [0, 0], EPSG:4326\nprint(transparent);\n\n// Create a multi-band image from a list of constants.\nvar orange = ee.Image([0xff, 0x88, 0x00]);\nMap.addLayer(orange, {min: 0, max: 0xff}, 'orange', false);\n// Image (3 bands)\n// type: Image\n// bands: List (3 elements)\n// 0: \"constant\", int ∈ [255, 255], EPSG:4326\n// 1: \"constant_1\", int ∈ [136, 136], EPSG:4326\n// 2: \"constant_2\", int ∈ [0, 0], EPSG:4326\nprint(orange);\n\n// Create a one band image where each pixel is an array of three values.\nvar imageOfArray = ee.Image(ee.Array([0x00, 0x00, 0xff]));\nMap.addLayer(imageOfArray, null, 'imageOfArray', false);\n// Image (1 band)\n// type: Image\n// bands: List (1 element)\n// 0: \"constant\", unsigned int8, 1 dimension, EPSG:4326\n// id: constant\n// crs: EPSG:4326\n// crs_transform: [1,0,0,0,1,0]\n// data_type: unsigned int8, 1 dimension\n// type: PixelType\n// dimensions: 1\n// max: 255\n// min: 0\n// precision: int\nprint(imageOfArray);\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\nimage = ee.Image('NASA/NASADEM_HGT/001')\n\nm = geemap.Map()\nm.zoom = 3\ndisplay(m)\nm.add_layer(image.select('elevation'), {'min': -1e3, 'max': 5e3}, 'Elevation')\n# Image NASA/NASADEM_HGT/001 (3 bands)\n# type: Image\n# id: NASA/NASADEM_HGT/001\n# version: 1641990521971299\n# 'bands': List (3 elements)\n# properties: Object (22 properties)\ndisplay(image)\n\ntransparent = ee.Image()\nm.add_layer(transparent, None, 'transparent', False)\n# Image (1 band)\n# type: Image\n# 'bands': List (1 element)\n# 0: \"constant\", int ∈ [0, 0], EPSG:4326\ndisplay(transparent)\n\n# Create a multi-band image from a list of constants.\norange = ee.Image([0xFF, 0x88, 0x00])\nm.add_layer(orange, {'min': 0, 'max': 0xFF}, 'orange', False)\n# Image (3 bands)\n# type: Image\n# 'bands': List (3 elements)\n# 0: \"constant\", int ∈ [255, 255], EPSG:4326\n# 1: \"constant_1\", int ∈ [136, 136], EPSG:4326\n# 2: \"constant_2\", int ∈ [0, 0], EPSG:4326\ndisplay(orange)\n\n# Create a one band image where each pixel is an array of three values.\nimage_of_array = ee.Image(ee.Array([0x00, 0x00, 0xFF]))\nm.add_layer(image_of_array, None, 'image_of_array', False)\n# Image (1 band)\n# type: Image\n# 'bands': List (1 element)\n# 0: \"constant\", unsigned int8, 1 dimension, EPSG:4326\n# id: constant\n# crs: EPSG:4326\n# crs_transform: [1,0,0,0,1,0]\n# data_type: unsigned int8, 1 dimension\n# type: PixelType\n# dimensions: 1\n# 'max': 255\n# 'min': 0\n# precision: int\ndisplay(image_of_array)\n```"]]