Export.image.toCloudStorage

Crea una tarea por lotes para exportar una imagen como un ráster a Google Cloud Storage. Las tareas se pueden iniciar desde la pestaña Tareas.

"crsTransform", "scale" y "dimensions" son mutuamente excluyentes.

UsoMuestra
Export.image.toCloudStorage(image, description, bucket, fileNamePrefix, dimensions, region, scale, crs, crsTransform, maxPixels, shardSize, fileDimensions, skipEmptyTiles, fileFormat, formatOptions, priority)
ArgumentoTipoDetalles
imageImagenLa imagen que se exportará.
descriptionString, opcionalUn nombre de la tarea legible por humanos. El valor predeterminado es "myExportImageTask".
bucketString, opcionalEl bucket de destino de Cloud Storage.
fileNamePrefixString, opcionalLa cadena que se usa como prefijo del resultado. Una "/" final indica una ruta de acceso. El valor predeterminado es la descripción de la tarea.
dimensionsNumber|String, opcionalLas dimensiones que se usarán para la imagen exportada. Toma un solo número entero positivo como la dimensión máxima o "WIDTHxHEIGHT", donde WIDTH y HEIGHT son números enteros positivos.
regionGeometry.LinearRing|Geometry.Polygon|String, opcionalUn LinearRing, un polígono o coordenadas que representan la región que se exportará. Se pueden especificar como objetos de geometría o coordenadas serializadas como una cadena.
scaleNumber, opcionalResolución en metros por píxel. La configuración predeterminada es 1,000.
crsString, opcionalCRS que se usará para la imagen exportada.
crsTransformList[Number]|String, opcionalTransformación afín que se usará para la imagen exportada. Requiere que se defina "crs".
maxPixelsNumber, opcionalRestringe la cantidad de píxeles en la exportación. De forma predeterminada, verás un error si la exportación supera los 1e8 píxeles. Si estableces este valor de forma explícita, se puede aumentar o disminuir este límite.
shardSizeNumber, opcionalTamaño en píxeles de los mosaicos en los que se calculará esta imagen. La configuración predeterminada es 256.
fileDimensionsList[Number]|Number, opcionalLas dimensiones en píxeles de cada archivo de imagen, si la imagen es demasiado grande para caber en un solo archivo. Puede especificar un solo número para indicar una forma cuadrada o un array de dos dimensiones para indicar (ancho, alto). Ten en cuenta que la imagen se recortará según las dimensiones generales de la imagen. Debe ser un múltiplo de shardSize.
skipEmptyTilesBoolean, opcionalSi es verdadero, omite la escritura de mosaicos de imágenes vacíos (es decir, completamente enmascarados). La configuración predeterminada es "false". Solo se admite en las exportaciones de GeoTIFF.
fileFormatString, opcionalEl formato de archivo de cadena al que se exporta la imagen. Actualmente, solo se admiten "GeoTIFF" y "TFRecord", y el valor predeterminado es "GeoTIFF".
formatOptionsImageExportFormatConfig, opcionalUn diccionario de claves de cadena para opciones específicas del formato. Para 'GeoTIFF': 'cloudOptimized' (booleano), 'noData' (flotante). Para "TFRecord", consulta https://developers.google.com/earth-engine/guides/tfrecord#formatoptions.
priorityNumber, opcionalLa prioridad de la tarea dentro del proyecto. Las tareas de mayor prioridad se programan antes. Debe ser un número entero entre 0 y 9999. La configuración predeterminada es 100.

Ejemplos

Editor de código (JavaScript)

// A Landsat 8 surface reflectance image.
var image = ee.Image('LANDSAT/LC08/C02/T1_L2/LC08_044034_20210508')
  .select(['SR_B.']);  // reflectance bands

// A region of interest.
var region = ee.Geometry.BBox(-122.24, 37.13, -122.11, 37.20);

// Set the export "scale" and "crs" parameters.
Export.image.toCloudStorage({
  image: image,
  description: 'image_export',
  bucket: 'gcs-bucket-name',
  fileNamePrefix: 'image_export',
  region: region,
  scale: 30,
  crs: 'EPSG:5070'
});

// Use the "crsTransform" export parameter instead of "scale" for more control
// over the output grid. Here, "crsTransform" is set to align the output grid
// with the grid of another dataset. To view an image's CRS transform:
// print(image.projection())
Export.image.toCloudStorage({
  image: image,
  description: 'image_export_crstransform',
  bucket: 'gcs-bucket-name',
  fileNamePrefix: 'image_export_crstransform',
  region: region,
  crsTransform: [30, 0, -2493045, 0, -30, 3310005],
  crs: 'EPSG:5070'
});

// If the export has more than 1e8 pixels, set "maxPixels" higher.
Export.image.toCloudStorage({
  image: image,
  description: 'image_export_maxpixels',
  bucket: 'gcs-bucket-name',
  fileNamePrefix: 'image_export_maxpixels',
  region: region,
  scale: 30,
  crs: 'EPSG:5070',
  maxPixels: 1e13
});

// Export a Cloud Optimized GeoTIFF (COG) by setting the "cloudOptimized"
// parameter to true.
Export.image.toCloudStorage({
  image: image,
  description: 'image_export_cog',
  bucket: 'gcs-bucket-name',
  fileNamePrefix: 'image_export_cog',
  region: region,
  scale: 30,
  crs: 'EPSG:5070',
  formatOptions: {
    cloudOptimized: true
  }
});

// Define a nodata value and replace masked pixels with it using "unmask".
// Set the "sameFootprint" parameter as "false" to include pixels outside of the
// image geometry in the unmasking operation.
var noDataVal = -9999;
var unmaskedImage = image.unmask({value: noDataVal, sameFootprint: false});
// Use the "noData" key in the "formatOptions" parameter to set the nodata value
// (GeoTIFF format only).
Export.image.toCloudStorage({
  image: unmaskedImage,
  description: 'image_export_nodata',
  bucket: 'gcs-bucket-name',
  fileNamePrefix: 'image_export_nodata',
  region: image.geometry(),  // full image bounds
  scale: 2000,  // large scale for minimal demo
  crs: 'EPSG:5070',
  fileFormat: 'GeoTIFF',
  formatOptions: {
    noData: noDataVal
  }
});

Configuración de Python

Consulta la página Entorno de Python para obtener información sobre la API de Python y el uso de geemap para el desarrollo interactivo.

import ee
import geemap.core as geemap

Colab (Python)

# A Landsat 8 surface reflectance image.
image = ee.Image(
    'LANDSAT/LC08/C02/T1_L2/LC08_044034_20210508'
).select(['SR_B.'])  # reflectance bands

# A region of interest.
region = ee.Geometry.BBox(-122.24, 37.13, -122.11, 37.20)

# Set the export "scale" and "crs" parameters.
task = ee.batch.Export.image.toCloudStorage(
    image=image,
    description='image_export',
    bucket='gcs-bucket-name',
    fileNamePrefix='image_export',
    region=region,
    scale=30,
    crs='EPSG:5070'
)
task.start()

# Use the "crsTransform" export parameter instead of "scale" for more control
# over the output grid. Here, "crsTransform" is set to align the output grid
# with the grid of another dataset. To view an image's CRS transform:
# display(image.projection())
task = ee.batch.Export.image.toCloudStorage(
    image=image,
    description='image_export_crstransform',
    bucket='gcs-bucket-name',
    fileNamePrefix='image_export_crstransform',
    region=region,
    crsTransform=[30, 0, -2493045, 0, -30, 3310005],
    crs='EPSG:5070'
)
task.start()

# If the export has more than 1e8 pixels, set "maxPixels" higher.
task = ee.batch.Export.image.toCloudStorage(
    image=image,
    description='image_export_maxpixels',
    bucket='gcs-bucket-name',
    fileNamePrefix='image_export_maxpixels',
    region=region,
    scale=30,
    crs='EPSG:5070',
    maxPixels=1e13
)
task.start()

# Export a Cloud Optimized GeoTIFF (COG) by setting the "cloudOptimized"
# parameter to true.
task = ee.batch.Export.image.toCloudStorage(
    image=image,
    description='image_export_cog',
    bucket='gcs-bucket-name',
    fileNamePrefix='image_export_cog',
    region=region,
    scale=30,
    crs='EPSG:5070',
    formatOptions={
        'cloudOptimized': True
    }
)
task.start()

# Define a nodata value and replace masked pixels with it using "unmask".
# Set the "sameFootprint" parameter as "false" to include pixels outside of the
# image geometry in the unmasking operation.
nodata_val = -9999
unmasked_image = image.unmask(value=nodata_val, sameFootprint=False)
# Use the "noData" key in the "formatOptions" parameter to set the nodata value
# (GeoTIFF format only).
task = ee.batch.Export.image.toCloudStorage(
    image=unmasked_image,
    description='image_export_nodata',
    bucket='gcs-bucket-name',
    fileNamePrefix='image_export_nodata',
    region=image.geometry(),  # full image bounds
    scale=2000,  # large scale for minimal demo
    crs='EPSG:5070',
    fileFormat='GeoTIFF',
    formatOptions={
       'noData': nodata_val
    }
)
task.start()