Sie können ein FeatureCollection mit Export.table als CSV, SHP (Shapefile), GeoJSON, KML, KMZ oder TFRecord exportieren. FeatureCollection kann Vektoren oder einfach eine Datentabelle darstellen. Im letzteren Fall haben die Elemente in der Sammlung eine Nullgeometrie.
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 unprojizierte Koordinaten (WGS84) umgewandelt. - SHP: Eine
FeatureCollection, die in ein Shapefile exportiert wird, muss Features mit demselben Geometrietyp und derselben Projektion enthalten und die Größenbeschränkungen für Shapefiles einhalten. Spaltennamen werden auf maximal 10 Zeichen gekürzt. Dadurch dürfen keine doppelten Spaltennamen entstehen. - TFRecord: Weitere Informationen finden Sie auf der Seite TFRecord-Datenformat.
in Cloud Storage
Verwenden Sie Export.table.toCloudStorage(), um eine FeatureCollection nach Cloud Storage zu exportieren. Beispiel mit dem zuvor definierten features:
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 ein FeatureCollection als Earth Engine-Asset exportieren möchten, verwenden Sie Export.table.toAsset(). Beispiel mit dem 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()
Es gibt mehrere Einschränkungen hinsichtlich der Größe und Form von Earth Engine-Tabellen-Assets:
- Maximal 100 Millionen Elemente
- Maximal 1.000 Attribute (Spalten)
- Maximal 100.000 Eckpunkte für die Geometrie jeder Zeile
- Maximal 100.000 Zeichen pro Stringwert
zu BigQuery
Sie können ein FeatureCollection mit Export.table.toBigQuery() in eine BigQuery-Tabelle exportieren.
So können Sie Ihre Earth Engine-Daten mit anderen in BigQuery verfügbaren Daten und Tools kombinieren. 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
Verwenden Sie Export.table.toDrive(), um ein FeatureCollection in Ihr Drive-Konto zu exportieren. 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()
Beachten Sie, dass das Ausgabeformat als KML angegeben ist, um geografische Daten zu verarbeiten (SHP wäre 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 wird gezeigt, wie Sie mit Export.table.toDrive() die Ergebnisse einer potenziell lang andauernden Reduzierung abrufen:
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.