אפשר לייצא FeatureCollection כקובץ CSV, SHP (קובץ shapefile), GeoJSON, KML, KMZ או TFRecord באמצעות Export.table. ה-FeatureCollection יכול לייצג וקטורים או פשוט טבלת נתונים. במקרה השני, לישויות באוסף תהיה גיאומטריה ריקה.
חשוב לשים לב למגבלות נוספות כשעובדים עם פורמטים מסוימים של קבצים, כולל:
- KML: ב-
FeatureCollectionשמיוצא לקובץ KML, כל הנתונים הגיאומטריים יומרו לקואורדינטות לא מוטלות (WGS84). - SHP: קובץ
FeatureCollectionשמיוצא ל-Shapefile חייב להכיל מאפיינים עם אותו סוג גיאומטריה והיטל, ולהתאים למגבלות הגודל של Shapefile. שמות העמודות נחתכים ל-10 תווים או פחות, וזה לא אמור ליצור שמות עמודות כפולים. - TFRecord: ראו את הדף פורמט הנתונים TFRecord.
ל-Cloud Storage
כדי לייצא FeatureCollection ל-Cloud Storage, משתמשים ב-Export.table.toCloudStorage(). לדוגמה, שימוש ב-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()
לנכס
כדי לייצא FeatureCollection כנכס של Earth Engine, משתמשים ב-Export.table.toAsset(). לדוגמה, שימוש ב-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()
יש כמה מגבלות על הגודל והצורה של נכסי טבלאות ב-Earth Engine:
- עד 100 מיליון ישויות
- עד 1,000 מאפיינים (עמודות)
- עד 100,000 קודקודים לכל גיאומטריה של שורה
- עד 100,000 תווים לכל ערך מחרוזת
ל-BigQuery
אפשר לייצא FeatureCollection לטבלה ב-BigQuery באמצעות Export.table.toBigQuery().
כך תוכלו לשלב את נתוני Earth Engine עם נתונים וכלים אחרים שזמינים ב-BigQuery. מידע נוסף זמין במדריך לייצוא ל-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()
ל-Drive
כדי לייצא FeatureCollection לחשבון Drive, משתמשים ב-Export.table.toDrive(). לדוגמה:
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()
שימו לב שפורמט הפלט מצוין כ-KML כדי לטפל בנתונים גיאוגרפיים (גם SHP מתאים לייצוא טבלה עם גיאומטריה). כדי לייצא רק טבלת נתונים, בלי מידע גיאוגרפי, מייצאים ישויות עם גיאומטריה ריקה בפורמט CSV. בדוגמה הבאה מוצג שימוש ב-Export.table.toDrive() כדי לקבל את התוצאות של צמצום שעשוי להימשך זמן רב:
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()
שימו לב שהפורמט מוגדר כ-CSV בדוגמה הזו, כי אין גיאומטריה בפלט.