公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
Export.image.toAsset
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
创建批量任务,以将映像作为栅格导出到 Earth Engine 资产。您可以在“任务”标签页中开始任务。
用法 | 返回 |
---|
Export.image.toAsset(image, description, assetId, pyramidingPolicy, dimensions, region, scale, crs, crsTransform, maxPixels, shardSize, priority) | |
参数 | 类型 | 详细信息 |
---|
image | 图片 | 要导出的图片。 |
description | 字符串,可选 | 任务的简明易懂的名称。默认为“myExportImageTask”。 |
assetId | 字符串,可选 | 目标素材资源 ID。 |
pyramidingPolicy | 对象,可选 | 要应用于图像中每个波段的层叠政策,按波段名称进行键控。值必须是以下之一:平均值、样本、最小值、最大值或众数。默认值为“mean”。您可以使用特殊键“.default”来更改所有频段的默认值。 |
dimensions | Number|String,可选 | 要用于导出图片的尺寸。接受单个正整数作为最大维度,或接受“WIDTHxHEIGHT”(其中 WIDTH 和 HEIGHT 均为正整数)。 |
region | Geometry.LinearRing|Geometry.Polygon|String,可选 | 要导出的区域,以 LinearRing、Polygon 或坐标表示。这些值可以指定为 Geometry 对象或序列化为字符串的坐标。 |
scale | 数字,可选 | 分辨率(以每像素米数为单位)。默认值为 1000。 |
crs | 字符串,可选 | 要用于导出图片的 CRS。 |
crsTransform | List<Number>|String,可选 | 用于导出图像的仿射转换。需要定义“crs”。 |
maxPixels | 数字,可选 | 限制导出中的像素数量。默认情况下,如果导出像素数超过 1 亿,您会看到一条错误消息。明确设置此值可提高或降低此限制。 |
shardSize | 数字,可选 | 将计算此图片的图块的大小(以像素为单位)。默认值为 256。 |
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.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'}
});
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.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()
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003eCreates a batch task to export an Earth Engine image as a raster to an Earth Engine asset.\u003c/p\u003e\n"],["\u003cp\u003eYou can specify parameters like the region, scale, CRS, and pyramiding policy for the export.\u003c/p\u003e\n"],["\u003cp\u003eTasks are initiated from the Tasks tab and can be monitored for progress and completion.\u003c/p\u003e\n"],["\u003cp\u003eFor large exports exceeding 1e8 pixels, the \u003ccode\u003emaxPixels\u003c/code\u003e parameter must be increased to prevent errors.\u003c/p\u003e\n"],["\u003cp\u003eExports can be customized to align with specific grids by utilizing the \u003ccode\u003ecrsTransform\u003c/code\u003e parameter alongside \u003ccode\u003ecrs\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Export.image.toAsset\n\n\u003cbr /\u003e\n\nCreates a batch task to export an Image as a raster to an Earth Engine asset. Tasks can be started from the Tasks tab.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|\n| `Export.image.toAsset(image, `*description* `, `*assetId* `, `*pyramidingPolicy* `, `*dimensions* `, `*region* `, `*scale* `, `*crs* `, `*crsTransform* `, `*maxPixels* `, `*shardSize* `, `*priority*`)` | |\n\n| Argument | Type | Details |\n|--------------------|---------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `image` | Image | The image to export. |\n| `description` | String, optional | A human-readable name of the task. Defaults to \"myExportImageTask\". |\n| `assetId` | String, optional | The destination asset ID. |\n| `pyramidingPolicy` | Object, optional | The pyramiding policy to apply to each band in the image, keyed by band name. Values must be one of: mean, sample, min, max, or mode. Defaults to \"mean\". A special key, \".default\" may be used to change the default for all bands. |\n| `dimensions` | Number\\|String, optional | The dimensions to use for the exported image. Takes either a single positive integer as the maximum dimension or \"WIDTHxHEIGHT\" where WIDTH and HEIGHT are each positive integers. |\n| `region` | Geometry.LinearRing\\|Geometry.Polygon\\|String, optional | A LinearRing, Polygon, or coordinates representing region to export. These may be specified as the Geometry objects or coordinates serialized as a string. |\n| `scale` | Number, optional | Resolution in meters per pixel. Defaults to 1000. |\n| `crs` | String, optional | CRS to use for the exported image. |\n| `crsTransform` | List\\\u003cNumber\\\u003e\\|String, optional | Affine transform to use for the exported image. Requires \"crs\" to be defined. |\n| `maxPixels` | Number, optional | Restrict the number of pixels in the export. By default, you will see an error if the export exceeds 1e8 pixels. Setting this value explicitly allows one to raise or lower this limit. |\n| `shardSize` | Number, optional | Size in pixels of the tiles in which this image will be computed. Defaults to 256. |\n| `priority` | Number, optional | The priority of the task within the project. Higher priority tasks are scheduled sooner. Must be an integer between 0 and 9999. Defaults to 100. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// A Landsat 8 surface reflectance image.\nvar image = ee.Image('LANDSAT/LC08/C02/T1_L2/LC08_044034_20210508')\n .select(['SR_B.']); // reflectance bands\n\n// A region of interest.\nvar region = ee.Geometry.BBox(-122.24, 37.13, -122.11, 37.20);\n\n// Set the export \"scale\" and \"crs\" parameters.\nExport.image.toAsset({\n image: image,\n description: 'image_export',\n assetId: 'projects/\u003cproject-name\u003e/assets/\u003casset-name\u003e', // \u003c\u003e modify these\n region: region,\n scale: 30,\n crs: 'EPSG:5070'\n});\n\n// Use the \"crsTransform\" export parameter instead of \"scale\" for more control\n// over the output grid. Here, \"crsTransform\" is set to align the output grid\n// with the grid of another dataset. To view an image's CRS transform:\n// print(image.projection())\nExport.image.toAsset({\n image: image,\n description: 'image_export_crstransform',\n assetId: 'projects/\u003cproject-name\u003e/assets/\u003casset-name\u003e', // \u003c\u003e modify these\n region: region,\n crsTransform: [30, 0, -2493045, 0, -30, 3310005],\n crs: 'EPSG:5070'\n});\n\n// If the export has more than 1e8 pixels, set \"maxPixels\" higher.\nExport.image.toAsset({\n image: image,\n description: 'image_export_maxpixels',\n assetId: 'projects/\u003cproject-name\u003e/assets/\u003casset-name\u003e', // \u003c\u003e modify these\n region: region,\n scale: 30,\n crs: 'EPSG:5070',\n maxPixels: 1e13\n});\n\n// The default \"pyramidingPolicy\" is mean. If data are categorical,\n// consider mode.\nExport.image.toAsset({\n image: image.select('SR_B5'),\n description: 'image_export_pyramiding',\n assetId: 'projects/\u003cproject-name\u003e/assets/\u003casset-name\u003e', // \u003c\u003e modify these\n region: region,\n scale: 30,\n crs: 'EPSG:5070',\n pyramidingPolicy: {SR_B5: 'mode'}\n});\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\n# A Landsat 8 surface reflectance image.\nimage = ee.Image(\n 'LANDSAT/LC08/C02/T1_L2/LC08_044034_20210508'\n).select(['SR_B.']) # reflectance bands\n\n# A region of interest.\nregion = ee.Geometry.BBox(-122.24, 37.13, -122.11, 37.20)\n\n# Set the export \"scale\" and \"crs\" parameters.\ntask = ee.batch.Export.image.toAsset(\n image=image,\n description='image_export',\n assetId='projects/\u003cproject-name\u003e/assets/\u003casset-name\u003e', # \u003c\u003e modify these\n region=region,\n scale=30,\n crs='EPSG:5070'\n)\ntask.start()\n\n# Use the \"crsTransform\" export parameter instead of \"scale\" for more control\n# over the output grid. Here, \"crsTransform\" is set to align the output grid\n# with the grid of another dataset. To view an image's CRS transform:\n# print(image.projection().getInfo())\ntask = ee.batch.Export.image.toAsset(\n image=image,\n description='image_export_crstransform',\n assetId='projects/\u003cproject-name\u003e/assets/\u003casset-name\u003e', # \u003c\u003e modify these\n region=region,\n crsTransform=[30, 0, -2493045, 0, -30, 3310005],\n crs='EPSG:5070'\n)\ntask.start()\n\n# If the export has more than 1e8 pixels, set \"maxPixels\" higher.\ntask = ee.batch.Export.image.toAsset(\n image=image,\n description='image_export_maxpixels',\n assetId='projects/\u003cproject-name\u003e/assets/\u003casset-name\u003e', # \u003c\u003e modify these\n region=region,\n scale=30,\n crs='EPSG:5070',\n maxPixels=1e13\n)\ntask.start()\n\n# The default \"pyramidingPolicy\" is mean. If data are categorical,\n# consider mode.\ntask = ee.batch.Export.image.toAsset(\n image=image.select('SR_B5'),\n description='image_export_pyramiding',\n assetId='projects/\u003cproject-name\u003e/assets/\u003casset-name\u003e', # \u003c\u003e modify these\n region=region,\n scale=30,\n crs='EPSG:5070',\n pyramidingPolicy={'SR_B5': 'mode'}\n)\ntask.start()\n```"]]