Export.table.toDrive

Erstellt einen Batchvorgang zum Exportieren einer FeatureCollection als Tabelle nach Drive. Aufgaben können über den Tab „Aufgaben“ gestartet werden.

NutzungAusgabe
Export.table.toDrive(collection, description, folder, fileNamePrefix, fileFormat, selectors, maxVertices, priority)
ArgumentTypDetails
collectionFeatureCollectionDie zu exportierende Sammlung von Funktionen.
descriptionString, optionalEin für Menschen lesbarer Name der Aufgabe. Darf Buchstaben, Zahlen, „-“ und „_“ enthalten (keine Leerzeichen). Der Standardwert ist „myExportTableTask“.
folderString, optionalDer Google Drive-Ordner, in dem sich der Export befindet. Hinweis: (a) Wenn der Ordnername auf einer beliebigen Ebene vorhanden ist, wird die Ausgabe dorthin geschrieben. (b) Wenn doppelte Ordnernamen vorhanden sind, wird die Ausgabe in den zuletzt geänderten Ordner geschrieben. (c) Wenn der Ordnername nicht vorhanden ist, wird ein neuer Ordner im Stammverzeichnis erstellt. (d) Ordnernamen mit Trennzeichen (z. B. „path/to/file“) werden als Literalstrings und nicht als Systempfade interpretiert. Standardmäßig ist das Drive-Stammverzeichnis festgelegt.
fileNamePrefixString, optionalDas Dateinamenpräfix. Darf Buchstaben, Zahlen, „-“ und „_“ enthalten (keine Leerzeichen). Die Standardeinstellung ist die Beschreibung.
fileFormatString, optionalDas Ausgabeformat: „CSV“ (Standard), „GeoJSON“, „KML“, „KMZ“, „SHP“ oder „TFRecord“.
selectorsList<String>|String, optionalEine Liste der Eigenschaften, die in den Export aufgenommen werden sollen. Dies kann entweder ein einzelner String mit durch Kommas getrennten Namen oder eine Liste von Strings sein.
maxVerticesNummer, optionalMaximale Anzahl von ungeschnittenen Knotenpunkten pro Geometrie. Geometrien mit mehr Knotenpunkten werden in kleinere Teile zerlegt.
priorityNummer, optionalDie Priorität der Aufgabe innerhalb des Projekts. Aufgaben mit höherer Priorität werden früher geplant. Muss eine Ganzzahl zwischen 0 und 9999 sein. Die Standardeinstellung ist 100.

Beispiele

Code-Editor (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'
});

Python einrichten

Informationen zur Python API und zur Verwendung von geemap für die interaktive Entwicklung finden Sie auf der Seite Python-Umgebung.

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()