Annuncio: tutti i progetti non commerciali registrati per l'utilizzo di Earth Engine prima del
15 aprile 2025 devono
verificare l'idoneità non commerciale per mantenere l'accesso a Earth Engine.
ee.Image.getDownloadURL
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Ottieni un URL di download per piccoli blocchi di dati immagine in formato GeoTIFF o NumPy. La dimensione massima della richiesta è 32 MB, la dimensione massima della griglia è 10.000.
Utilizza getThumbURL per i formati di visualizzazione RGB PNG e JPG.
Restituisce un URL di download o undefined se è stato specificato un callback.
Utilizzo | Resi |
---|
Image.getDownloadURL(params, callback) | Object|String |
Argomento | Tipo | Dettagli |
---|
questo: image | Immagine | L'istanza Image. |
params | Oggetto | Un oggetto contenente le opzioni di download con i seguenti valori possibili:
name: un nome di base da utilizzare per la creazione dei nomi dei file. Applicabile solo quando il formato è "ZIPPED_GEO_TIFF" (predefinito) o filePerBand è true. Il valore predefinito è l'ID immagine (o "download" per le immagini calcolate) quando il formato è "ZIPPED_GEO_TIFF" o filePerBand è true, altrimenti viene generata una stringa di caratteri casuale. I nomi delle band vengono aggiunti quando filePerBand è true. |
bands: una descrizione delle band da scaricare. Deve essere un array di nomi di bande o un array di dizionari, ognuno con le seguenti chiavi (i parametri facoltativi si applicano solo quando filePerBand è true):
id: il nome della band, una stringa, obbligatorio.
crs: una stringa CRS facoltativa che definisce la proiezione della banda.
crs_transform: un array facoltativo di 6 numeri che specificano una trasformazione affine dal sistema di riferimento delle coordinate specificato, in ordine di riga: [xScale, xShearing, xTranslation, yShearing, yScale, yTranslation]
dimensions: un array facoltativo di due numeri interi che definiscono la larghezza e l'altezza a cui viene ritagliata la banda.
scale: un numero facoltativo che specifica la scala in metri della banda; viene ignorato se vengono specificati crs e crs_transform. |
crs: una stringa CRS predefinita da utilizzare per le bande che non ne specificano esplicitamente una. |
crs_transform: una trasformazione affine predefinita da utilizzare per le bande che non ne specificano una, dello stesso formato di
crs_transform delle bande. |
Dimensioni di ritaglio predefinite dell'immagine dimensions: da utilizzare per le bande che non le specificano. |
scale: una scala predefinita da utilizzare per le bande che non ne specificano una; viene ignorata se sono specificati crs e
crs_transform . |
region: un poligono che specifica una regione da scaricare; viene ignorato se vengono specificati crs e crs_transform . |
filePerBand: se produrre un GeoTIFF separato per banda (booleano). Il valore predefinito è true. Se il valore è false, viene prodotto un singolo GeoTIFF e tutte le trasformazioni a livello di banda vengono ignorate. |
format: il formato di download. Uno dei seguenti:
- "ZIPPED_GEO_TIFF" (file GeoTIFF compressi in un file ZIP, impostazione predefinita)
- "GEO_TIFF" (file GeoTIFF)
- "NPY" (formato binario NumPy)
Se "GEO_TIFF" o "NPY", filePerBand e tutte le trasformazioni a livello di banda verranno ignorate. Il caricamento di un output NumPy genera un array strutturato. |
|
callback | Funzione, facoltativa | Un callback facoltativo. Se non viene fornito, la chiamata viene effettuata in modo sincrono. |
Esempi
Editor di codice (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);
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'
}));
Configurazione di Python
Consulta la pagina
Ambiente Python per informazioni sull'API Python e sull'utilizzo di
geemap
per lo sviluppo interattivo.
import ee
import geemap.core as geemap
Colab (Python)
"""Demonstrates the ee.Image.getDownloadURL 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
url = img.getDownloadUrl({
'bands': ['B3', 'B8', 'B11'],
'region': region,
'scale': 20,
'format': 'NPY'
})
response = requests.get(url)
data = numpy.load(io.BytesIO(response.content))
print(data)
print(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)
with open('single_band.zip', 'wb') as fd:
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)
with open('multi_band.zip', 'wb') as fd:
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)
with open('custom_single_band.zip', 'wb') as fd:
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)
with open('multi_band.tif', 'wb') as fd:
fd.write(response.content)
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-07-26 UTC.
[null,null,["Ultimo aggiornamento 2025-07-26 UTC."],[],["`Image.getDownloadURL` retrieves download URLs for image data in GeoTIFF or NumPy formats, with a 32 MB maximum size and 10,000 grid dimension limit. Parameters include specifying `name`, `bands`, `crs`, `crs_transform`, `dimensions`, `scale`, `region`, and `filePerBand`, and `format`. Formats can be ZIPPED_GEO_TIFF, GEO_TIFF, or NPY. The `getThumbURL` method is recommended for RGB formats. The method returns a download URL or is undefined if a callback is provided.\n"],null,[]]