ee.ImageCollection.toBands

Chuyển đổi một tập hợp thành một hình ảnh nhiều dải tần chứa tất cả các dải tần của mọi hình ảnh trong tập hợp. Các dải đầu ra được đặt tên bằng cách thêm tiền tố cho tên dải hiện có bằng mã nhận dạng hình ảnh mà dải đó xuất phát (ví dụ: "image1_band1").

Lưu ý: Số lượng dải tần tối đa là 5.000.

Cách sử dụngGiá trị trả về
ImageCollection.toBands()Hình ảnh
Đối sốLoạiThông tin chi tiết
this: collectionImageCollectionBộ sưu tập đầu vào.

Ví dụ

Trình soạn thảo mã (JavaScript)

// A Landsat 8 TOA image collection (2 months of images at a specific point).
var col = ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA')
  .filterBounds(ee.Geometry.Point(-90.70, 34.71))
  .filterDate('2020-07-01', '2020-09-01')
  .select('B[4-5]');  // Get NIR and SWIR1 bands only.
print('Collection', col);

// Convert the image collection to a single multi-band image. Note that image ID
// ('system:index') is prepended to band names to delineate the source images.
var img = col.toBands();
print('Collection to bands', img);

// Band order is determined by collection order. Here, the collection is
// sorted in descending order of the date of observation (reverse of previous).
var bandOrder = col.sort('DATE_ACQUIRED', false).toBands();
print('Customized band order', bandOrder);

Thiết lập Python

Hãy xem trang Môi trường Python để biết thông tin về Python API và cách sử dụng geemap cho quá trình phát triển có tính tương tác.

import ee
import geemap.core as geemap

Colab (Python)

# A Landsat 8 TOA image collection (2 months of images at a specific point).
col = (
    ee.ImageCollection('LANDSAT/LC08/C02/T1_TOA')
    .filterBounds(ee.Geometry.Point(-90.70, 34.71))
    .filterDate('2020-07-01', '2020-09-01')
    .select('B[4-5]')
)  # Get NIR and SWIR1 bands only.
display('Collection:', col)

# Convert the image collection to a single multi-band image. Note that image ID
# ('system:index') is prepended to band names to delineate the source images.
img = col.toBands()
display('Collection to bands:', img)

# Band order is determined by collection order. Here, the collection is
# sorted in descending order of the date of observation (reverse of previous).
band_order = col.sort('DATE_ACQUIRED', False).toBands()
display('Customized band order:', band_order)