公告:凡是在
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 環境頁面,瞭解 Python API 和如何使用 geemap
進行互動式開發。
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)
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間: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```"]]