公告:凡是在
2025 年 4 月 15 日前註冊使用 Earth Engine 的非商業專案,都必須
驗證非商業用途資格,才能繼續存取 Earth Engine。
ee.Image
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
代表 Earth Engine 圖片的物件。這個建構函式接受多種引數:
- 字串:EarthEngine 資產 ID,
- 字串和數字:EarthEngine 資產 ID 和版本,
- 數字或 ee.Array:建立常數圖片,
- 清單:從每個清單元素建立圖片,然後合併為單一圖片,
- ee.Image:傳回引數,
- 無:產生空白透明圖片。
引數 | 類型 | 詳細資料 |
---|
args | 圖片|List<Object>|數字|物件|字串,選用 | 建構函式引數。 |
範例
程式碼編輯器 (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 環境頁面,瞭解 Python API 和如何使用 geemap
進行互動式開發。
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)
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間: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```"]]