Announcement: All noncommercial projects registered to use Earth Engine beforeApril 15, 2025 mustverify noncommercial eligibility to maintain access. If you have not verified by September 26, 2025, your access may be on hold.

ee.Image.getDownloadURL

  • UsegetDownloadURL to retrieve small chunks of image data in GeoTIFF or NumPy format, with maximum request size of 32 MB and grid dimensions up to 10000.

  • getThumbURL is used for obtaining RGB visualization formats like PNG and JPG.

  • ThegetDownloadURL function returns a download URL string or an Object, and an optional callback function can be provided for asynchronous calls.

  • Download options in theparams object include specifying band names, CRS, scale, region, output format (ZIPPED_GEO_TIFF, GEO_TIFF, NPY), and whether to output a file per band.

  • The examples demonstrate how to download image data as single-band or multi-band GeoTIFF files (zipped or unzipped) and as a NumPy array using both JavaScript (Code Editor) and Python (Colab).

Get a download URL for small chunks of image data in GeoTIFF or NumPy format. Maximum request size is 32 MB, maximum grid dimension is 10000.

Use getThumbURL for RGB visualization formats PNG and JPG.

Returns returns a download URL, or undefined if a callback was specified.

UsageReturns
Image.getDownloadURL(params,callback)Object|String
ArgumentTypeDetails
this:imageImageThe Image instance.
paramsObjectAn object containing download options with the following possible values:
name: a base name to use when constructing filenames. Only applicable when format is "ZIPPED_GEO_TIFF" (default) or filePerBand is true. Defaults to the image id (or "download" for computed images) when format is "ZIPPED_GEO_TIFF" or filePerBand is true, otherwise a random character string is generated. Band names are appended when filePerBand is true.
bands: a description of the bands to download. Must be an array of band names or an array of dictionaries, each with the following keys (optional parameters apply only when filePerBand is true):
  • id: the name of the band, a string, required.
  • crs: an optional CRS string defining the band projection.
  • crs_transform: an optional array of 6 numbers specifying an affine transform from the specified CRS, in row-major order: [xScale, xShearing, xTranslation, yShearing, yScale, yTranslation]
  • dimensions: an optional array of two integers defining the width and height to which the band is cropped.
  • scale: an optional number, specifying the scale in meters of the band; ignored if crs and crs_transform are specified.
crs: a default CRS string to use for any bands that do not explicitly specify one.
crs_transform: a default affine transform to use for any bands that do not specify one, of the same format as thecrs_transform of bands.
dimensions: default image cropping dimensions to use for any bands that do not specify them.
scale: a default scale to use for any bands that do not specify one; ignored ifcrs andcrs_transform are specified.
region: a polygon specifying a region to download; ignored ifcrs andcrs_transform is specified.
filePerBand: whether to produce a separate GeoTIFF per band (boolean). Defaults to true. If false, a single GeoTIFF is produced and all band-level transformations will be ignored.
format: the download format. One of:
  • "ZIPPED_GEO_TIFF" (GeoTIFF file(s) wrapped in a zip file, default)
  • "GEO_TIFF" (GeoTIFF file)
  • "NPY" (NumPy binary format)
If "GEO_TIFF" or "NPY", filePerBand and all band-level transformations will be ignored. Loading a NumPy output results in a structured array.
callbackFunction, optionalAn optional callback. If not supplied, the call is made synchronously.

Examples

Code Editor (JavaScript)

// A Sentinel-2 surface reflectance image.varimg=ee.Image('COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG');// A small region within the image.varregion=ee.Geometry.BBox(-122.0859,37.0436,-122.0626,37.0586);print('Single-band GeoTIFF files wrapped in a zip file',img.getDownloadURL({name:'single_band',bands:['B3','B8','B11'],region:region}));print('Multi-band GeoTIFF file wrapped in a zip file',img.getDownloadURL({name:'multi_band',bands:['B3','B8','B11'],region:region,scale:20,filePerBand:false}));print('Band-specific transformations',img.getDownloadURL({name:'custom_single_band',bands:[{id:'B3',scale:10},{id:'B8',scale:10},{id:'B11',scale:20}],region:region}));print('Multi-band GeoTIFF file',img.getDownloadURL({bands:['B3','B8','B11'],region:region,scale:20,format:'GEO_TIFF'}));

Python setup

See the Python Environment page for information on the Python API and usinggeemap for interactive development.

importeeimportgeemap.coreasgeemap

Colab (Python)

"""Demonstrates the ee.Image.getDownloadURL method."""importioimportnumpyimportrequests# 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.url=img.getDownloadUrl({'bands':['B3','B8','B11'],'region':region,'scale':20,'format':'NPY'})response=requests.get(url)data=numpy.load(io.BytesIO(response.content))display(data)display(data.dtype)# Single-band GeoTIFF files wrapped in a zip file.url=img.getDownloadUrl({'name':'single_band','bands':['B3','B8','B11'],'region':region})response=requests.get(url)withopen('single_band.zip','wb')asfd:fd.write(response.content)# Multi-band GeoTIFF file wrapped in a zip file.url=img.getDownloadUrl({'name':'multi_band','bands':['B3','B8','B11'],'region':region,'scale':20,'filePerBand':False})response=requests.get(url)withopen('multi_band.zip','wb')asfd:fd.write(response.content)# Band-specific transformations.url=img.getDownloadUrl({'name':'custom_single_band','bands':[{'id':'B3','scale':10},{'id':'B8','scale':10},{'id':'B11','scale':20}],'region':region})response=requests.get(url)withopen('custom_single_band.zip','wb')asfd:fd.write(response.content)# Multi-band GeoTIFF file.url=img.getDownloadUrl({'bands':['B3','B8','B11'],'region':region,'scale':20,'format':'GEO_TIFF'})response=requests.get(url)withopen('multi_band.tif','wb')asfd:fd.write(response.content)

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-02-20 UTC.