Thông báo : Tất cả dự án phi thương mại đã đăng ký sử dụng Earth Engine trước
ngày 15 tháng 4 năm 2025 phải
xác minh điều kiện sử dụng phi thương mại để duy trì quyền truy cập. Nếu bạn chưa xác minh trước ngày 26 tháng 9 năm 2025, quyền truy cập của bạn có thể bị tạm ngưng.
Gửi ý kiến phản hồi
ee.ImageCollection.select
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Chọn các dải tần từ mỗi hình ảnh trong một bộ sưu tập.
Trả về bộ sưu tập hình ảnh có các dải tần được chọn.
Cách sử dụng Giá trị trả về ImageCollection. select (selectors, names )
ImageCollection
Đối số Loại Thông tin chi tiết this: imagecollection
ImageCollection Đối tượng ImageCollection. selectors
List<Object> Danh sách tên, biểu thức chính quy hoặc chỉ mục số chỉ định các dải tần cần chọn. names
List<String>, không bắt buộc Danh sách tên mới cho các dải đầu ra. Phải khớp với số lượng dải tần được chọn.
Ví dụ
Trình soạn thảo mã (JavaScript)
// A Sentinel-2 surface reflectance image collection.
var col = ee . ImageCollection ( 'COPERNICUS/S2_SR' )
. filterBounds ( ee . Geometry . Point ( - 122.152 , 37.336 ))
. filterDate ( '2021-01-01' , '2021-02-01' );
print ( 'All band names' , col . first (). bandNames ());
print ( 'Select a band by name' ,
col . select ( 'B11' ). first (). bandNames ());
print ( 'Select a band by index' ,
col . select ( 10 ). first (). bandNames ());
print ( 'Select bands using a list' ,
col . select ([ 'B11' , 'B8' , 'B3' ]). first (). bandNames ());
print ( 'Select bands by an argument series' ,
col . select ( 'B11' , 'B8' , 'B3' ). first (). bandNames ());
print ( 'Mixing string and integer selectors is valid' ,
col . select ( 10 , 'B8' , 2 ). first (). bandNames ());
print ( 'Rename selected bands using two corresponding lists' ,
col . select ([ 'B11' , 'B8' , 'B3' ], [ 'SWIR1' , 'NIR' , 'Green' ])
. first (). bandNames ());
// Use regular expressions to select bands.
print ( 'Match "QA" followed by any two characters' ,
col . select ( 'QA..' ). first (). bandNames ());
print ( 'Match "B" followed by any character, any number of times' ,
col . select ( 'B.*' ). first (). bandNames ());
print ( 'Match "B" followed by any character, and any optional third character' ,
col . select ( 'B..?' ). first (). bandNames ());
print ( 'Match "B" followed by a character in the range 6-8' ,
col . select ( 'B[6-8]' ). first (). bandNames ());
print ( 'Match "B" followed by a character in the range 1-9 and then 1-2' ,
col . select ( 'B[1-9][1-2]' ). first (). bandNames ());
print ( 'Match "B" or "QA" each followed by any character, any number of times.' ,
col . select ( 'B.*|QA.*' ). first (). bandNames ());
Thiết lập Python
Hãy xem trang
Môi trường Python để biết thông tin về API Python và cách sử dụng geemap
cho quá trình phát triển tương tác.
import ee
import geemap.core as geemap
Colab (Python)
# A Sentinel-2 surface reflectance image collection.
col = ee . ImageCollection ( 'COPERNICUS/S2_SR' ) . filterBounds (
ee . Geometry . Point ( - 122.152 , 37.336 )
) . filterDate ( '2021-01-01' , '2021-02-01' )
print ( 'All band names' , col . first () . bandNames () . getInfo ())
print ( 'Select a band by name:' ,
col . select ( 'B11' ) . first () . bandNames () . getInfo ())
print ( 'Select a band by index:' ,
col . select ( 10 ) . first () . bandNames () . getInfo ())
print ( 'Select bands using a list:' ,
col . select ([ 'B11' , 'B8' , 'B3' ]) . first () . bandNames () . getInfo ())
print ( 'Select bands by an argument series:' ,
col . select ( 'B11' , 'B8' , 'B3' ) . first () . bandNames () . getInfo ())
print ( 'Mixing string and integer selectors is valid:' ,
col . select ( 10 , 'B8' , 2 ) . first () . bandNames () . getInfo ())
print ( 'Rename selected bands using two corresponding lists:' ,
col . select ([ 'B11' , 'B8' , 'B3' ], [ 'SWIR1' , 'NIR' , 'Green' ])
. first () . bandNames () . getInfo ())
# Use regular expressions to select bands.
print ( 'Match "QA" followed by any two characters:' ,
col . select ( 'QA..' ) . first () . bandNames () . getInfo ())
print ( 'Match "B" followed by any character, any number of times:' ,
col . select ( 'B.*' ) . first () . bandNames () . getInfo ())
print ( 'Match "B" followed by any character, and any optional third character:' ,
col . select ( 'B..?' ) . first () . bandNames () . getInfo ())
print ( 'Match "B" followed by a character in the range 6-8:' ,
col . select ( 'B[6-8]' ) . first () . bandNames () . getInfo ())
print ( 'Match "B" followed by a character in the range 1-9 and then 1-2:' ,
col . select ( 'B[1-9][1-2]' ) . first () . bandNames () . getInfo ())
print ( 'Match "B" or "QA" each followed by any character, any number of times:' ,
col . select ( 'B.*|QA.*' ) . first () . bandNames () . getInfo ())
Gửi ý kiến phản hồi
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0 . Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers . Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-25 UTC.
Bạn muốn chia sẻ thêm với chúng tôi?
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[],["The `select` method extracts specific bands from an ImageCollection, returning a new ImageCollection with those bands. Band selection can be done by name, index, or a list of these. New band names can be assigned using an optional list, which must match the number of selected bands. Regular expressions can also be used to select bands based on pattern matching. The code examples demonstrate these selection techniques for both JavaScript and Python.\n"]]