Export.table.toDrive

Crea un'attività batch per esportare una FeatureCollection come tabella in Drive. Le attività possono essere avviate dalla scheda Attività.

UtilizzoResi
Export.table.toDrive(collection, description, folder, fileNamePrefix, fileFormat, selectors, maxVertices, priority)
ArgomentoTipoDettagli
collectionFeatureCollectionLa raccolta di funzionalità da esportare.
descriptionStringa, facoltativaUn nome leggibile dell'attività. Può contenere lettere, numeri, trattini (-) e trattini bassi (_) (senza spazi). Il valore predefinito è "myExportTableTask".
folderStringa, facoltativaLa cartella di Google Drive in cui verrà inserita l'esportazione. Nota: (a) se il nome della cartella esiste a qualsiasi livello, l'output viene scritto al suo interno, (b) se esistono nomi di cartelle duplicati, l'output viene scritto nella cartella modificata più di recente, (c) se il nome della cartella non esiste, viene creata una nuova cartella nella radice e (d) i nomi delle cartelle con separatori (ad es. "path/to/file") vengono interpretati come stringhe letterali, non come percorsi di sistema. Il valore predefinito è la radice di Drive.
fileNamePrefixStringa, facoltativaIl prefisso del nome file. Può contenere lettere, numeri, trattini (-) e trattini bassi (_) (senza spazi). Il valore predefinito è la descrizione.
fileFormatStringa, facoltativaIl formato di output: "CSV" (predefinito), "GeoJSON", "KML", "KMZ", "SHP" o "TFRecord".
selectorsList<String>|String, facoltativoUn elenco di proprietà da includere nell'esportazione; una singola stringa con nomi separati da virgole o un elenco di stringhe.
maxVerticesNumero, facoltativoNumero massimo di vertici non tagliati per geometria; le geometrie con più vertici verranno suddivise in parti più piccole di questa dimensione.
priorityNumero, facoltativoLa priorità dell'attività all'interno del progetto. Le attività con priorità più alta vengono pianificate prima. Deve essere un numero intero compreso tra 0 e 9999. Il valore predefinito è 100.

Esempi

Editor di codice (JavaScript)

// A Sentinel-2 surface reflectance image.
var img = ee.Image('COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG');
Map.setCenter(-122.359, 37.428, 9);
Map.addLayer(img, {bands: ['B11', 'B8', 'B3'], min: 100, max: 3500}, 'img');

// Sample the image at 20 m scale, a point feature collection is returned.
var samp = img.sample({scale: 20, numPixels: 50, geometries: true});
Map.addLayer(samp, {color: 'white'}, 'samp');
print('Image sample feature collection', samp);

// Export the image sample feature collection to Drive as a CSV file.
Export.table.toDrive({
  collection: samp,
  description: 'image_sample_demo_csv',
  folder: 'earth_engine_demos',
  fileFormat: 'CSV'
});

// Export a subset of collection properties: three bands and the geometry
// as GeoJSON.
Export.table.toDrive({
  collection: samp,
  description: 'image_sample_demo_prop_subset',
  folder: 'earth_engine_demos',
  fileFormat: 'GeoJSON',
  selectors: ['B8', 'B11', 'B12', '.geo']
});

// Export the image sample feature collection to Drive as a shapefile.
Export.table.toDrive({
  collection: samp,
  description: 'image_sample_demo_shp',
  folder: 'earth_engine_demos',
  fileFormat: 'SHP'
});

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)

# A Sentinel-2 surface reflectance image.
img = ee.Image('COPERNICUS/S2_SR/20210109T185751_20210109T185931_T10SEG')
m = geemap.Map()
m.set_center(-122.359, 37.428, 9)
m.add_layer(
    img, {'bands': ['B11', 'B8', 'B3'], 'min': 100, 'max': 3500}, 'img'
)

# Sample the image at 20 m scale, a point feature collection is returned.
samp = img.sample(scale=20, numPixels=50, geometries=True)
m.add_layer(samp, {'color': 'white'}, 'samp')
display(m)
display('Image sample feature collection', samp)

# Export the image sample feature collection to Drive as a CSV file.
task = ee.batch.Export.table.toDrive(
    collection=samp,
    description='image_sample_demo_csv',
    folder='earth_engine_demos',
    fileFormat='CSV',
)
task.start()

# Export a subset of collection properties: three bands and the geometry
# as GeoJSON.
task = ee.batch.Export.table.toDrive(
    collection=samp,
    description='image_sample_demo_prop_subset',
    folder='earth_engine_demos',
    fileFormat='GeoJSON',
    selectors=['B8', 'B11', 'B12', '.geo'],
)
task.start()

# Export the image sample feature collection to Drive as a shapefile.
task = ee.batch.Export.table.toDrive(
    collection=samp,
    description='image_sample_demo_shp',
    folder='earth_engine_demos',
    fileFormat='SHP',
)
task.start()