Export.image.toDrive
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
สร้างงานแบบกลุ่มเพื่อส่งออกรูปภาพเป็นแรสเตอร์ไปยังไดรฟ์ คุณเริ่มงานได้จากแท็บ Tasks "crsTransform", "scale" และ "dimensions" ใช้ร่วมกันไม่ได้
การใช้งาน | การคืนสินค้า |
---|
Export.image.toDrive(image, description, folder, fileNamePrefix, dimensions, region, scale, crs, crsTransform, maxPixels, shardSize, fileDimensions, skipEmptyTiles, fileFormat, formatOptions, priority) | |
อาร์กิวเมนต์ | ประเภท | รายละเอียด |
---|
image | รูปภาพ | รูปภาพที่จะส่งออก |
description | สตริง ไม่บังคับ | ชื่อของงานที่มนุษย์อ่านได้ อาจมีตัวอักษร ตัวเลข ขีดกลาง ขีดล่าง (ไม่มีช่องว่าง) ค่าเริ่มต้นคือ "myExportImageTask" |
folder | สตริง ไม่บังคับ | โฟลเดอร์ Google ไดรฟ์ที่จะมีไฟล์ที่ส่งออก หมายเหตุ: (ก) หากมีชื่อโฟลเดอร์ในระดับใดก็ตาม ระบบจะเขียนเอาต์พุตไปยังโฟลเดอร์นั้น (ข) หากมีชื่อโฟลเดอร์ที่ซ้ำกัน ระบบจะเขียนเอาต์พุตไปยังโฟลเดอร์ที่แก้ไขล่าสุด (ค) หากไม่มีชื่อโฟลเดอร์ ระบบจะสร้างโฟลเดอร์ใหม่ที่รูท และ (ง) ระบบจะตีความชื่อโฟลเดอร์ที่มีตัวคั่น (เช่น "path/to/file") เป็นสตริงตามตัวอักษร ไม่ใช่เส้นทางของระบบ ค่าเริ่มต้นคือรูทของไดรฟ์ |
fileNamePrefix | สตริง ไม่บังคับ | คำนำหน้าชื่อไฟล์ อาจมีตัวอักษร ตัวเลข ขีดกลาง ขีดล่าง (ไม่มีช่องว่าง) ค่าเริ่มต้นคือคำอธิบาย |
dimensions | Number|String, ไม่บังคับ | ขนาดที่จะใช้กับรูปภาพที่ส่งออก รับจำนวนเต็มบวกรายการเดียวเป็นมิติข้อมูลสูงสุด หรือ "WIDTHxHEIGHT" โดยที่ WIDTH และ HEIGHT เป็นจำนวนเต็มบวก |
region | Geometry.LinearRing|Geometry.Polygon|String, ไม่บังคับ | LinearRing, Polygon หรือพิกัดที่แสดงภูมิภาคที่จะส่งออก โดยอาจระบุเป็นออบเจ็กต์ Geometry หรือพิกัดที่แปลงเป็นสตริง |
scale | หมายเลข (ไม่บังคับ) | ความละเอียดเป็นเมตรต่อพิกเซล ค่าเริ่มต้นคือ 1,000 |
crs | สตริง ไม่บังคับ | CRS ที่จะใช้สำหรับรูปภาพที่ส่งออก |
crsTransform | List<Number>|String, ไม่บังคับ | การแปลงแบบแอฟฟินที่จะใช้กับรูปภาพที่ส่งออก ต้องกำหนด "crs" |
maxPixels | หมายเลข (ไม่บังคับ) | จำกัดจำนวนพิกเซลในการส่งออก โดยค่าเริ่มต้น คุณจะเห็นข้อผิดพลาดหากการส่งออกมีขนาดเกิน 1e8 พิกเซล การตั้งค่านี้อย่างชัดเจนจะช่วยให้คุณเพิ่มหรือลดขีดจำกัดนี้ได้ |
shardSize | หมายเลข (ไม่บังคับ) | ขนาดเป็นพิกเซลของไทล์ที่จะใช้คำนวณรูปภาพนี้ ค่าเริ่มต้นคือ 256 |
fileDimensions | List<Number>|Number, ไม่บังคับ | ขนาดในหน่วยพิกเซลของไฟล์ภาพแต่ละไฟล์ หากภาพมีขนาดใหญ่เกินกว่าจะใส่ในไฟล์เดียว อาจระบุตัวเลขเดียวเพื่อระบุรูปร่างสี่เหลี่ยมจัตุรัส หรืออาร์เรย์ของ 2 มิติเพื่อระบุ (ความกว้าง ความสูง) โปรดทราบว่าระบบจะยังคงตัดรูปภาพให้มีขนาดตามขนาดรูปภาพโดยรวม ต้องเป็นผลคูณของ shardSize |
skipEmptyTiles | บูลีน ไม่บังคับ | หากเป็นจริง ให้ข้ามการเขียนไทล์รูปภาพที่ว่างเปล่า (เช่น มาสก์ทั้งหมด) ค่าเริ่มต้นคือ false รองรับเฉพาะการส่งออก GeoTIFF |
fileFormat | สตริง ไม่บังคับ | รูปแบบไฟล์สตริงที่จะส่งออกรูปภาพ ปัจจุบันรองรับเฉพาะ "GeoTIFF" และ "TFRecord" โดยค่าเริ่มต้นจะเป็น "GeoTIFF" |
formatOptions | ImageExportFormatConfig (ไม่บังคับ) | พจนานุกรมของคีย์สตริงสำหรับตัวเลือกที่เจาะจงรูปแบบ สำหรับ "GeoTIFF": "cloudOptimized"
(บูลีน), "noData" (ลอย) สำหรับ "TFRecord" โปรดดู https://developers.google.com/earth-engine/guides/tfrecord#formatoptions |
priority | หมายเลข (ไม่บังคับ) | ลำดับความสำคัญของงานภายในโปรเจ็กต์ ระบบจะกำหนดเวลางานที่มีลำดับความสำคัญสูงกว่าให้เร็วขึ้น ต้องเป็นจำนวนเต็มระหว่าง 0 ถึง 9999 ค่าเริ่มต้นคือ 100 |
ตัวอย่าง
โปรแกรมแก้ไขโค้ด (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.toDrive({
image: image,
description: 'image_export',
folder: 'ee_demos',
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.toDrive({
image: image,
description: 'image_export_crstransform',
folder: 'ee_demos',
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.toDrive({
image: image,
description: 'image_export_maxpixels',
folder: 'ee_demos',
region: region,
scale: 30,
crs: 'EPSG:5070',
maxPixels: 1e13
});
// Export a Cloud Optimized GeoTIFF (COG) by setting the "cloudOptimized"
// parameter to true.
Export.image.toDrive({
image: image,
description: 'image_export_cog',
folder: 'ee_demos',
region: region,
scale: 30,
crs: 'EPSG:5070',
formatOptions: {
cloudOptimized: true
}
});
// Define a nodata value and replace masked pixels with it using "unmask".
// Set the "sameFootprint" parameter as "false" to include pixels outside of the
// image geometry in the unmasking operation.
var noDataVal = -9999;
var unmaskedImage = image.unmask({value: noDataVal, sameFootprint: false});
// Use the "noData" key in the "formatOptions" parameter to set the nodata value
// (GeoTIFF format only).
Export.image.toDrive({
image: unmaskedImage,
description: 'image_export_nodata',
folder: 'ee_demos',
region: image.geometry(), // full image bounds
scale: 2000, // large scale for minimal demo
crs: 'EPSG:5070',
fileFormat: 'GeoTIFF',
formatOptions: {
noData: noDataVal
}
});
การตั้งค่า Python
ดูข้อมูลเกี่ยวกับ Python API และการใช้ geemap
เพื่อการพัฒนาแบบอินเทอร์แอกทีฟได้ที่หน้า
สภาพแวดล้อม Python
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.toDrive(
image=image,
description='image_export',
folder='ee_demos',
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.toDrive(
image=image,
description='image_export_crstransform',
folder='ee_demos',
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.toDrive(
image=image,
description='image_export_maxpixels',
folder='ee_demos',
region=region,
scale=30,
crs='EPSG:5070',
maxPixels=1e13
)
task.start()
# Export a Cloud Optimized GeoTIFF (COG) by setting the "cloudOptimized"
# parameter to true.
task = ee.batch.Export.image.toDrive(
image=image,
description='image_export_cog',
folder='ee_demos',
region=region,
scale=30,
crs='EPSG:5070',
formatOptions={
'cloudOptimized': True
}
)
task.start()
# Define a nodata value and replace masked pixels with it using "unmask".
# Set the "sameFootprint" parameter as "false" to include pixels outside of the
# image geometry in the unmasking operation.
nodata_val = -9999
unmasked_image = image.unmask(value=nodata_val, sameFootprint=False)
# Use the "noData" key in the "formatOptions" parameter to set the nodata value
# (GeoTIFF format only).
task = ee.batch.Export.image.toDrive(
image=unmasked_image,
description='image_export_nodata',
folder='ee_demos',
region=image.geometry(), # full image bounds
scale=2000, # large scale for minimal demo
crs='EPSG:5070',
fileFormat='GeoTIFF',
formatOptions={
'noData': nodata_val
}
)
task.start()
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[[["\u003cp\u003eThis function exports an Earth Engine image as a raster to your Google Drive.\u003c/p\u003e\n"],["\u003cp\u003eYou can customize the export by specifying parameters like file name, folder, region, scale, and projection.\u003c/p\u003e\n"],["\u003cp\u003eFor large exports, you can control the tiling and pixel limits using parameters like \u003ccode\u003emaxPixels\u003c/code\u003e, \u003ccode\u003eshardSize\u003c/code\u003e, and \u003ccode\u003efileDimensions\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eGeoTIFF and TFRecord are the supported export file formats with options for compression and NoData values.\u003c/p\u003e\n"],["\u003cp\u003eTasks are initiated from the 'Tasks' tab in the Earth Engine Code Editor and can be monitored for progress and completion.\u003c/p\u003e\n"]]],["This creates a batch task to export an image as a raster to Google Drive. Key parameters include the `image`, `description`, `folder`, `fileNamePrefix`, and `region`. Users can define `dimensions`, `scale`, `crs`, or `crsTransform` for output customization; these options are mutually exclusive. Additional settings involve `maxPixels`, `shardSize`, `fileDimensions`, `skipEmptyTiles`, `fileFormat`, `formatOptions`, and `priority`. Tasks can be initiated from the Tasks tab, allowing for control over the exported raster's properties and storage location.\n"],null,[]]