公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
ee.data.makeDownloadUrl
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
根据 docid 和令牌创建下载网址。
返回下载网址。
用法 | 返回 |
---|
ee.data.makeDownloadUrl(id) | 字符串 |
参数 | 类型 | 详细信息 |
---|
id | DownloadId | 下载 ID 和令牌。 |
示例
代码编辑器 (JavaScript)
// A Sentinel-2 surface reflectance image.
var img = ee.Image('COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG');
// A small region within the image.
var region = ee.Geometry.BBox(-122.0859, 37.0436, -122.0626, 37.0586);
var downloadId = ee.data.getDownloadId({
image: img,
name: 'single_band',
bands: ['B3', 'B8', 'B11'],
region: region
});
print('Single-band GeoTIFF files wrapped in a zip file',
ee.data.makeDownloadUrl(downloadId));
Python 设置
如需了解 Python API 和如何使用 geemap
进行交互式开发,请参阅
Python 环境页面。
import ee
import geemap.core as geemap
Colab (Python)
"""Demonstrates the ee.data.makeDownloadUrl method."""
import io
import requests
import ee
ee.Authenticate()
ee.Initialize()
# A Sentinel-2 surface reflectance image.
img = ee.Image('COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG')
# A small region within the image.
region = ee.Geometry.BBox(-122.0859, 37.0436, -122.0626, 37.0586)
# Image chunk as a NumPy structured array.
import numpy
download_id = ee.data.getDownloadId({
'image': img,
'bands': ['B3', 'B8', 'B11'],
'region': region,
'scale': 20,
'format': 'NPY'
})
response = requests.get(ee.data.makeDownloadUrl(download_id))
data = numpy.load(io.BytesIO(response.content))
print(data)
print(data.dtype)
# Single-band GeoTIFF files wrapped in a zip file.
download_id = ee.data.getDownloadId({
'image': img,
'name': 'single_band',
'bands': ['B3', 'B8', 'B11'],
'region': region
})
response = requests.get(ee.data.makeDownloadUrl(download_id))
with open('single_band.zip', 'wb') as fd:
fd.write(response.content)
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003e\u003ccode\u003eee.data.makeDownloadUrl\u003c/code\u003e creates a download URL for Earth Engine data using a download ID and token.\u003c/p\u003e\n"],["\u003cp\u003eThe download ID can be obtained with \u003ccode\u003eee.data.getDownloadId\u003c/code\u003e, specifying parameters such as the image, bands, region, and file format.\u003c/p\u003e\n"],["\u003cp\u003eThis function returns a string representing the URL from which the data can be downloaded.\u003c/p\u003e\n"],["\u003cp\u003eYou can use libraries like \u003ccode\u003erequests\u003c/code\u003e in Python to download the data from the generated URL.\u003c/p\u003e\n"]]],[],null,["# ee.data.makeDownloadUrl\n\n\u003cbr /\u003e\n\nCreate a download URL from a docid and token.\n\n\u003cbr /\u003e\n\nReturns the download URL.\n\n| Usage | Returns |\n|-------------------------------|---------|\n| `ee.data.makeDownloadUrl(id)` | String |\n\n| Argument | Type | Details |\n|----------|------------|--------------------------|\n| `id` | DownloadId | A download id and token. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// A Sentinel-2 surface reflectance image.\nvar img = ee.Image('COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG');\n\n// A small region within the image.\nvar region = ee.Geometry.BBox(-122.0859, 37.0436, -122.0626, 37.0586);\n\nvar downloadId = ee.data.getDownloadId({\n image: img,\n name: 'single_band',\n bands: ['B3', 'B8', 'B11'],\n region: region\n});\nprint('Single-band GeoTIFF files wrapped in a zip file',\n ee.data.makeDownloadUrl(downloadId));\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\"\"\"Demonstrates the ee.data.makeDownloadUrl method.\"\"\"\n\nimport io\nimport requests\nimport ee\n\n\nee.Authenticate()\nee.Initialize()\n\n# A Sentinel-2 surface reflectance image.\nimg = ee.Image('COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG')\n\n# A small region within the image.\nregion = ee.Geometry.BBox(-122.0859, 37.0436, -122.0626, 37.0586)\n\n# Image chunk as a NumPy structured array.\nimport numpy\ndownload_id = ee.data.getDownloadId({\n 'image': img,\n 'bands': ['B3', 'B8', 'B11'],\n 'region': region,\n 'scale': 20,\n 'format': 'NPY'\n})\nresponse = requests.get(ee.data.makeDownloadUrl(download_id))\ndata = numpy.load(io.BytesIO(response.content))\nprint(data)\nprint(data.dtype)\n\n# Single-band GeoTIFF files wrapped in a zip file.\ndownload_id = ee.data.getDownloadId({\n 'image': img,\n 'name': 'single_band',\n 'bands': ['B3', 'B8', 'B11'],\n 'region': region\n})\nresponse = requests.get(ee.data.makeDownloadUrl(download_id))\nwith open('single_band.zip', 'wb') as fd:\n fd.write(response.content)\n```"]]