تصدير بيانات الجداول والمتّجهات

يمكنك تصدير 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 المحدَّد سابقًا:

أداة تعديل الرموز (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'
});

إعداد Python

يُرجى الاطّلاع على صفحة بيئة Python للحصول على معلومات حول واجهة برمجة التطبيقات Python API واستخدام geemap للتطوير التفاعلي.

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 المحدّد سابقًا:

أداة تعديل الرموز (JavaScript)

// Export an ee.FeatureCollection as an Earth Engine asset.
Export.table.toAsset({
  collection: features,
  description:'exportToTableAssetExample',
  assetId: 'exampleAssetId',
});

إعداد Python

يُرجى الاطّلاع على صفحة بيئة Python للحصول على معلومات حول واجهة برمجة التطبيقات Python API واستخدام geemap للتطوير التفاعلي.

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.

أداة تعديل الرموز (JavaScript)

Export.table.toBigQuery({
  collection: features,
  table: 'myproject.mydataset.mytable',
  description: 'put_my_data_in_bigquery',
  append: true,
  overwrite: false
});

إعداد Python

يُرجى الاطّلاع على صفحة بيئة Python للحصول على معلومات حول واجهة برمجة التطبيقات Python API واستخدام geemap للتطوير التفاعلي.

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(). على سبيل المثال:

أداة تعديل الرموز (JavaScript)

// Export the FeatureCollection to a KML file.
Export.table.toDrive({
  collection: features,
  description:'vectorsToDriveExample',
  fileFormat: 'KML'
});

إعداد Python

يُرجى الاطّلاع على صفحة بيئة Python للحصول على معلومات حول واجهة برمجة التطبيقات Python API واستخدام geemap للتطوير التفاعلي.

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() للحصول على نتائج عملية اختزال قد تستغرق وقتًا طويلاً:

أداة تعديل الرموز (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'
});

إعداد Python

يُرجى الاطّلاع على صفحة بيئة Python للحصول على معلومات حول واجهة برمجة التطبيقات Python API واستخدام geemap للتطوير التفاعلي.

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" في هذا المثال لعدم توفّر بيانات هندسية في الناتج.