Export.image.toAsset

Tạo một tác vụ hàng loạt để xuất Hình ảnh dưới dạng một raster sang một tài sản Earth Engine. Bạn có thể bắt đầu việc cần làm từ thẻ Tasks.

Cách sử dụngGiá trị trả về
Export.image.toAsset(image, description, assetId, pyramidingPolicy, dimensions, region, scale, crs, crsTransform, maxPixels, shardSize, priority)
Đối sốLoạiThông tin chi tiết
imageHình ảnhHình ảnh cần xuất.
descriptionChuỗi, không bắt buộcTên dễ đọc của việc cần làm. Giá trị mặc định là "myExportImageTask".
assetIdChuỗi, không bắt buộcMã nhận dạng tài sản đích.
pyramidingPolicyĐối tượng, không bắt buộcChính sách tạo lớp hình ảnh thu nhỏ để áp dụng cho từng dải trong hình ảnh, được xác định theo tên dải. Giá trị phải là một trong các giá trị sau: trung bình, mẫu, tối thiểu, tối đa hoặc phương thức. Giá trị mặc định là "mean". Bạn có thể dùng một khoá đặc biệt ".default" để thay đổi giá trị mặc định cho tất cả các dải tần.
dimensionsNumber|String, không bắt buộcKích thước dùng cho hình ảnh được xuất. Lấy một số nguyên dương duy nhất làm kích thước tối đa hoặc "WIDTHxHEIGHT", trong đó WIDTH và HEIGHT đều là số nguyên dương.
regionGeometry.LinearRing|Geometry.Polygon|String, không bắt buộcLinearRing, Polygon hoặc toạ độ đại diện cho khu vực cần xuất. Bạn có thể chỉ định các đối tượng này dưới dạng đối tượng Hình học hoặc toạ độ được chuyển đổi tuần tự thành một chuỗi.
scaleSố, không bắt buộcĐộ phân giải tính bằng mét trên mỗi pixel. Giá trị mặc định là 1000.
crsChuỗi, không bắt buộcCRS sẽ dùng cho hình ảnh được xuất.
crsTransformList<Number>|String, optionalPhép biến đổi affine dùng cho hình ảnh được xuất. Yêu cầu bạn xác định "crs".
maxPixelsSố, không bắt buộcHạn chế số lượng pixel trong tệp xuất. Theo mặc định, bạn sẽ thấy lỗi nếu dữ liệu xuất vượt quá 100 triệu pixel. Việc đặt giá trị này một cách rõ ràng cho phép bạn tăng hoặc giảm giới hạn này.
shardSizeSố, không bắt buộcKích thước tính bằng pixel của các ô mà hình ảnh này sẽ được tính toán. Giá trị mặc định là 256.
prioritySố, không bắt buộcMứ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 Landsat 8 surface reflectance image.
var image = ee.Image('LANDSAT/LC08/C02/T1_L2/LC08_044034_20210508')
  .select(['SR_B.']);  // reflectance bands

// A region of interest.
var region = ee.Geometry.BBox(-122.24, 37.13, -122.11, 37.20);

// Set the export "scale" and "crs" parameters.
Export.image.toAsset({
  image: image,
  description: 'image_export',
  assetId: 'projects/<project-name>/assets/<asset-name>',  // <> modify these
  region: region,
  scale: 30,
  crs: 'EPSG:5070'
});

// Use the "crsTransform" export parameter instead of "scale" for more control
// over the output grid. Here, "crsTransform" is set to align the output grid
// with the grid of another dataset. To view an image's CRS transform:
// print(image.projection())
Export.image.toAsset({
  image: image,
  description: 'image_export_crstransform',
  assetId: 'projects/<project-name>/assets/<asset-name>',  // <> modify these
  region: region,
  crsTransform: [30, 0, -2493045, 0, -30, 3310005],
  crs: 'EPSG:5070'
});

// If the export has more than 1e8 pixels, set "maxPixels" higher.
Export.image.toAsset({
  image: image,
  description: 'image_export_maxpixels',
  assetId: 'projects/<project-name>/assets/<asset-name>',  // <> modify these
  region: region,
  scale: 30,
  crs: 'EPSG:5070',
  maxPixels: 1e13
});

// The default "pyramidingPolicy" is mean. If data are categorical,
// consider mode.
Export.image.toAsset({
  image: image.select('SR_B5'),
  description: 'image_export_pyramiding',
  assetId: 'projects/<project-name>/assets/<asset-name>',  // <> modify these
  region: region,
  scale: 30,
  crs: 'EPSG:5070',
  pyramidingPolicy: {SR_B5: 'mode'}
});

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 Landsat 8 surface reflectance image.
image = ee.Image(
    'LANDSAT/LC08/C02/T1_L2/LC08_044034_20210508'
).select(['SR_B.'])  # reflectance bands

# A region of interest.
region = ee.Geometry.BBox(-122.24, 37.13, -122.11, 37.20)

# Set the export "scale" and "crs" parameters.
task = ee.batch.Export.image.toAsset(
    image=image,
    description='image_export',
    assetId='projects/<project-name>/assets/<asset-name>',  # <> modify these
    region=region,
    scale=30,
    crs='EPSG:5070'
)
task.start()

# Use the "crsTransform" export parameter instead of "scale" for more control
# over the output grid. Here, "crsTransform" is set to align the output grid
# with the grid of another dataset. To view an image's CRS transform:
# print(image.projection().getInfo())
task = ee.batch.Export.image.toAsset(
    image=image,
    description='image_export_crstransform',
    assetId='projects/<project-name>/assets/<asset-name>',  # <> modify these
    region=region,
    crsTransform=[30, 0, -2493045, 0, -30, 3310005],
    crs='EPSG:5070'
)
task.start()

# If the export has more than 1e8 pixels, set "maxPixels" higher.
task = ee.batch.Export.image.toAsset(
    image=image,
    description='image_export_maxpixels',
    assetId='projects/<project-name>/assets/<asset-name>',  # <> modify these
    region=region,
    scale=30,
    crs='EPSG:5070',
    maxPixels=1e13
)
task.start()

# The default "pyramidingPolicy" is mean. If data are categorical,
# consider mode.
task = ee.batch.Export.image.toAsset(
    image=image.select('SR_B5'),
    description='image_export_pyramiding',
    assetId='projects/<project-name>/assets/<asset-name>',  # <> modify these
    region=region,
    scale=30,
    crs='EPSG:5070',
    pyramidingPolicy={'SR_B5': 'mode'}
)
task.start()