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.
Export.table.toDrive
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.
Tạo một tác vụ hàng loạt để xuất FeatureCollection dưới dạng bảng sang Drive. Bạn có thể bắt đầu việc cần làm từ thẻ Tasks.
Cách sử dụng | Giá trị trả về |
---|
Export.table.toDrive(collection, description, folder, fileNamePrefix, fileFormat, selectors, maxVertices, priority) | |
Đối số | Loại | Thông tin chi tiết |
---|
collection | FeatureCollection | Bộ sưu tập đối tượng cần xuất. |
description | Chuỗi, không bắt buộc | Tên dễ đọc của việc cần làm. Có thể chứa chữ cái, số, dấu gạch ngang, dấu gạch dưới (không có dấu cách). Giá trị mặc định là "myExportTableTask". |
folder | Chuỗi, không bắt buộc | Thư mục trên Google Drive nơi tệp xuất sẽ được lưu trữ. Lưu ý: (a) nếu tên thư mục tồn tại ở bất kỳ cấp độ nào, đầu ra sẽ được ghi vào đó, (b) nếu có tên thư mục trùng lặp, đầu ra sẽ được ghi vào thư mục được sửa đổi gần đây nhất, (c) nếu tên thư mục không tồn tại, một thư mục mới sẽ được tạo ở thư mục gốc và (d) tên thư mục có dấu phân cách (ví dụ: "path/to/file") được hiểu là chuỗi ký tự chứ không phải đường dẫn hệ thống. Giá trị mặc định là thư mục gốc của Drive. |
fileNamePrefix | Chuỗi, không bắt buộc | Tiền tố tên tệp. Có thể chứa chữ cái, số, dấu gạch ngang, dấu gạch dưới (không có dấu cách). Giá trị mặc định là nội dung mô tả. |
fileFormat | Chuỗi, không bắt buộc | Định dạng đầu ra: "CSV" (mặc định), "GeoJSON", "KML", "KMZ", "SHP" hoặc "TFRecord". |
selectors | List<String>|String, không bắt buộc | Danh sách các thuộc tính cần đưa vào tệp xuất; có thể là một chuỗi duy nhất có tên được phân tách bằng dấu phẩy hoặc một danh sách các chuỗi. |
maxVertices | Số, không bắt buộc | Số lượng đỉnh tối đa chưa cắt trên mỗi hình học; các hình học có nhiều đỉnh hơn sẽ được cắt thành các phần nhỏ hơn kích thước này. |
priority | Số, không bắt buộc | Mức độ ưu tiên của công việc trong dự án. Các công việc có mức độ ưu tiên cao hơn sẽ được lên lịch sớm hơn. Phải là số nguyên từ 0 đến 9999. Giá trị mặc định là 100. |
Ví dụ
Trình soạn thảo mã (JavaScript)
// A Sentinel-2 surface reflectance image.
var img = ee.Image('COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG');
Map.setCenter(-122.359, 37.428, 9);
Map.addLayer(img, {bands: ['B11', 'B8', 'B3'], min: 100, max: 3500}, 'img');
// Sample the image at 20 m scale, a point feature collection is returned.
var samp = img.sample({scale: 20, numPixels: 50, geometries: true});
Map.addLayer(samp, {color: 'white'}, 'samp');
print('Image sample feature collection', samp);
// Export the image sample feature collection to Drive as a CSV file.
Export.table.toDrive({
collection: samp,
description: 'image_sample_demo_csv',
folder: 'earth_engine_demos',
fileFormat: 'CSV'
});
// Export a subset of collection properties: three bands and the geometry
// as GeoJSON.
Export.table.toDrive({
collection: samp,
description: 'image_sample_demo_prop_subset',
folder: 'earth_engine_demos',
fileFormat: 'GeoJSON',
selectors: ['B8', 'B11', 'B12', '.geo']
});
// Export the image sample feature collection to Drive as a shapefile.
Export.table.toDrive({
collection: samp,
description: 'image_sample_demo_shp',
folder: 'earth_engine_demos',
fileFormat: 'SHP'
});
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.
img = ee.Image('COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG')
m = geemap.Map()
m.set_center(-122.359, 37.428, 9)
m.add_layer(
img, {'bands': ['B11', 'B8', 'B3'], 'min': 100, 'max': 3500}, 'img'
)
# Sample the image at 20 m scale, a point feature collection is returned.
samp = img.sample(scale=20, numPixels=50, geometries=True)
m.add_layer(samp, {'color': 'white'}, 'samp')
display(m)
display('Image sample feature collection', samp)
# Export the image sample feature collection to Drive as a CSV file.
task = ee.batch.Export.table.toDrive(
collection=samp,
description='image_sample_demo_csv',
folder='earth_engine_demos',
fileFormat='CSV',
)
task.start()
# Export a subset of collection properties: three bands and the geometry
# as GeoJSON.
task = ee.batch.Export.table.toDrive(
collection=samp,
description='image_sample_demo_prop_subset',
folder='earth_engine_demos',
fileFormat='GeoJSON',
selectors=['B8', 'B11', 'B12', '.geo'],
)
task.start()
# Export the image sample feature collection to Drive as a shapefile.
task = ee.batch.Export.table.toDrive(
collection=samp,
description='image_sample_demo_shp',
folder='earth_engine_demos',
fileFormat='SHP',
)
task.start()
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.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[],["This function exports a FeatureCollection as a table to Google Drive. Key actions include specifying the `collection`, task `description`, target `folder`, `fileNamePrefix`, and `fileFormat` (CSV, GeoJSON, KML, KMZ, SHP, or TFRecord). Optional actions include specifying `selectors` to limit exported properties, setting `maxVertices` to manage geometry size, and `priority` to control task scheduling. Multiple examples show how to export sampled image data to Drive in various formats.\n"]]