Announcement: All noncommercial projects registered to use Earth Engine before
April 15, 2025 must
verify noncommercial eligibility to maintain Earth Engine access.
ee.data.makeDownloadUrl
Stay organized with collections
Save and categorize content based on your preferences.
Create a download URL from a docid and token.
Returns the download URL.
Usage | Returns | ee.data.makeDownloadUrl(id) | String |
Argument | Type | Details | id | DownloadId | A download id and token. |
Examples
Code Editor (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 setup
See the
Python Environment page for information on the Python API and using
geemap
for interactive development.
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)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[[["\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```"]]