Mit Export.table
können Sie eine FeatureCollection
als CSV-, SHP- (Shapefile), GeoJSON-, KML-, KMZ- oder TFRecord-Datei exportieren. FeatureCollection
kann Vektoren oder einfach eine Datentabelle darstellen. In letzterem Fall haben die Elemente in der Sammlung keine Geometrie.
Beachten Sie bei der Arbeit mit einigen Dateiformaten die folgenden zusätzlichen Einschränkungen:
- KML: Bei einer
FeatureCollection
, die in eine KML-Datei exportiert wird, werden alle Geometrien in nicht projizierte (WGS84) Koordinaten umgewandelt. - SHP: Ein in ein Shapefile exportiertes
FeatureCollection
muss Features mit demselben Geometriestyp und derselben Projektion enthalten und die Größenbeschränkungen für Shapefiles einhalten. Spaltennamen werden auf maximal 10 Zeichen gekürzt. Dabei dürfen keine doppelten Spaltennamen entstehen. - TFRecord: Weitere Informationen
zu Cloud Storage
Verwenden Sie Export.table.toCloudStorage()
, um eine FeatureCollection
nach Cloud Storage zu exportieren. Beispiel: Verwenden Sie features
, das Sie zuvor definiert haben:
Code-Editor (JavaScript)
// Make a collection of points. var features = ee.FeatureCollection([ ee.Feature(ee.Geometry.Point(30.41, 59.933), {name: 'Voronoi'}), ee.Feature(ee.Geometry.Point(-73.96, 40.781), {name: 'Thiessen'}), ee.Feature(ee.Geometry.Point(6.4806, 50.8012), {name: 'Dirichlet'}) ]); // Export a KML file to Cloud Storage. Export.table.toCloudStorage({ collection: features, description:'vectorsToCloudStorageExample', bucket: 'your-bucket-name', fileNamePrefix: 'exampleTableExport', fileFormat: 'KML' });
import ee import geemap.core as geemap
Colab (Python)
# Make a collection of points. features = ee.FeatureCollection([ ee.Feature(ee.Geometry.Point(30.41, 59.933), {'name': 'Voronoi'}), ee.Feature(ee.Geometry.Point(-73.96, 40.781), {'name': 'Thiessen'}), ee.Feature(ee.Geometry.Point(6.4806, 50.8012), {'name': 'Dirichlet'}), ]) # Export a KML file to Cloud Storage. task = ee.batch.Export.table.toCloudStorage( collection=features, description='vectorsToCloudStorageExample', bucket='your-bucket-name', fileNamePrefix='exampleTableExport', fileFormat='KML', ) task.start()
zu Asset
Wenn Sie eine FeatureCollection
als Earth Engine-Asset exportieren möchten, verwenden Sie Export.table.toAsset()
. Verwenden Sie beispielsweise den zuvor definierten features
:
Code-Editor (JavaScript)
// Export an ee.FeatureCollection as an Earth Engine asset. Export.table.toAsset({ collection: features, description:'exportToTableAssetExample', assetId: 'exampleAssetId', });
import ee import geemap.core as geemap
Colab (Python)
# Export an ee.FeatureCollection as an Earth Engine asset. task = ee.batch.Export.table.toAsset( collection=features, description='exportToTableAssetExample', assetId='projects/your-project/assets/exampleAssetId', ) task.start()
Für die Größe und Form von Earth Engine-Tabellen-Assets gelten mehrere Einschränkungen:
- Maximal 100 Millionen Elemente
- Maximal 1.000 Properties (Spalten)
- Maximal 100.000 Ecken für die Geometrie jeder Zeile
- Maximal 100.000 Zeichen pro Stringwert
in BigQuery
Mit Export.table.toBigQuery()
können Sie eine FeatureCollection
in eine BigQuery-Tabelle exportieren.
So können Sie Ihre Earth Engine-Daten mit anderen Daten und Tools in BigQuery integrieren. Weitere Informationen finden Sie im Leitfaden zum Exportieren nach BigQuery.
Code-Editor (JavaScript)
Export.table.toBigQuery({ collection: features, table: 'myproject.mydataset.mytable', description: 'put_my_data_in_bigquery', append: true, overwrite: false });
import ee import geemap.core as geemap
Colab (Python)
task = ee.batch.Export.table.toBigQuery( collection=features, table='myproject.mydataset.mytable', description='put_my_data_in_bigquery', append=True, overwrite=False, ) task.start()
zu Drive
Wenn Sie eine FeatureCollection
in Ihr Drive-Konto exportieren möchten, verwenden Sie Export.table.toDrive()
. Beispiel:
Code-Editor (JavaScript)
// Export the FeatureCollection to a KML file. Export.table.toDrive({ collection: features, description:'vectorsToDriveExample', fileFormat: 'KML' });
import ee import geemap.core as geemap
Colab (Python)
# Export the FeatureCollection to a KML file. task = ee.batch.Export.table.toDrive( collection=features, description='vectorsToDriveExample', fileFormat='KML' ) task.start()
Das Ausgabeformat ist KML, um geografische Daten zu verarbeiten. SHP ist auch für den Export einer Tabelle mit Geometrie geeignet. Wenn Sie nur eine Datentabelle ohne geografische Informationen exportieren möchten, exportieren Sie Elemente mit Nullgeometrie im CSV-Format. Im folgenden Beispiel wird gezeigt, wie mit Export.table.toDrive()
die Ergebnisse einer potenziell lang laufenden Reduzierung abgerufen werden:
Code-Editor (JavaScript)
// Load a Landsat image. var image = ee.Image('LANDSAT/LC08/C02/T1_TOA/LC08_044034_20140318'); var projection = image.select('B2').projection().getInfo(); // Create an arbitrary rectangle. var region = ee.Geometry.Rectangle(-122.2806, 37.1209, -122.0554, 37.2413); // Get a dictionary of means in the region. var means = image.reduceRegion({ reducer: ee.Reducer.mean(), geometry: region, crs: projection.crs, crsTransform: projection.transform, }); // Make a feature without geometry and set the properties to the dictionary of means. var feature = ee.Feature(null, means); // Wrap the Feature in a FeatureCollection for export. var featureCollection = ee.FeatureCollection([feature]); // Export the FeatureCollection. Export.table.toDrive({ collection: featureCollection, description: 'exportTableExample', fileFormat: 'CSV' });
import ee import geemap.core as geemap
Colab (Python)
# Load a Landsat image. image = ee.Image('LANDSAT/LC08/C02/T1_TOA/LC08_044034_20140318') projection = image.select('B2').projection().getInfo() # Create an arbitrary rectangle. region = ee.Geometry.Rectangle(-122.2806, 37.1209, -122.0554, 37.2413) # Get a dictionary of means in the region. means = image.reduceRegion( reducer=ee.Reducer.mean(), geometry=region, crs=projection['crs'], crsTransform=projection['transform'], ) # Make a feature without geometry and set the properties to the dictionary of means. feature = ee.Feature(None, means) # Wrap the Feature in a FeatureCollection for export. feature_collection = ee.FeatureCollection([feature]) # Export the FeatureCollection. task = ee.batch.Export.table.toDrive( collection=feature_collection, description='exportTableExample', fileFormat='CSV', ) task.start()
In diesem Beispiel ist das Format auf „CSV“ festgelegt, da die Ausgabe keine Geometrie enthält.