ee.Image

表示 Earth Engine 影像的对象。此构造函数可接受各种实参:

  - 字符串:EarthEngine 资产 ID,

- 一个字符串和一个数字:EarthEngine 资产 ID 和版本,

  - 数字或 ee.Array:创建常量映像,

  - 列表:根据每个列表元素创建一张图片,并将它们合并为一张图片,

  - ee.Image:返回实参,

- 无:生成一张空白透明图片。

用法返回
ee.Image(args)图片
参数类型详细信息
argsImage|List,可选构造函数实参。

示例

代码编辑器 (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)