公告 :凡是在
2025 年 4 月 15 日前 註冊使用 Earth Engine 的非商業專案,都必須
驗證非商業用途資格 ,才能繼續存取。如未在 2025 年 9 月 26 日前完成驗證,存取權可能會暫停。
提供意見 Export.image.toDrive 透過集合功能整理內容 你可以依據偏好儲存及分類內容。
建立批次工作,將圖片匯出為光柵至 Google 雲端硬碟。你可以從「工作」分頁啟動工作。「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 雲端硬碟資料夾。注意:(a) 如果資料夾名稱存在於任何層級,輸出內容會寫入該資料夾;(b) 如果存在重複的資料夾名稱,輸出內容會寫入最近修改的資料夾;(c) 如果資料夾名稱不存在,系統會在根目錄建立新資料夾;(d) 含有分隔符的資料夾名稱 (例如「path/to/file」) 會解讀為字串常值,而非系統路徑。預設為雲端硬碟根目錄。 fileNamePrefix字串 (選用) 檔案名稱前置字串。可包含英文字母、數字、連字號、底線 (不得有空格)。預設為說明。 dimensionsNumber|String,選填 匯出圖片時使用的尺寸。可接受單一正整數做為最大尺寸,或「WIDTHxHEIGHT」,其中 WIDTH 和 HEIGHT 皆為正整數。 regionGeometry.LinearRing|Geometry.Polygon|String,選用 代表要匯出區域的 LinearRing、Polygon 或座標。這些可以是 Geometry 物件,也可以是序列化為字串的座標。 scale號碼 (選填) 以每像素公尺為單位的解析度。預設值為 1000。 crs字串 (選用) 用於匯出圖片的 CRS。 crsTransformList<Number>|String,選用 用於匯出圖片的仿射轉換。必須定義「crs」。 maxPixels號碼 (選填) 限制匯出像素數量。根據預設,如果匯出作業超過 1 億像素,系統會顯示錯誤訊息。明確設定這個值可提高或降低這個限制。 shardSize號碼 (選填) 圖片計算時所用圖塊的大小 (以像素為單位)。預設值為 256。 fileDimensionsList<Number>|Number,選用 每個圖片檔案的像素尺寸 (如果圖片過大,無法放入單一檔案)。可以指定單一數字來表示正方形,也可以指定兩個維度的陣列來表示 (寬度、高度)。請注意,圖片仍會裁剪為整體圖片尺寸。必須是 shardSize 的倍數。 skipEmptyTiles布林值 (選填) 如果是 true,則略過寫入空白 (即完全遮蓋) 的圖片圖塊。預設值為 false。僅支援 GeoTIFF 匯出。 fileFormat字串 (選用) 圖片匯出的字串檔案格式。目前僅支援「GeoTIFF」和「TFRecord」,預設為「GeoTIFF」。 formatOptionsImageExportFormatConfig (選用) 字串鍵的字典,用於格式專屬選項。如果是「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 環境 頁面,瞭解 Python API 和如何使用 geemap 進行互動式開發。
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: # display(image.projection()) 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 () 提供意見
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權 ,程式碼範例則為阿帕契 2.0 授權 。詳情請參閱《Google Developers 網站政策 》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-10-25 (世界標準時間)。
想進一步說明嗎? [[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-10-25 (世界標準時間)。"],[],["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"]]