Export.table.toDrive

یک تکلیف دسته‌ای برای صادر کردن FeatureCollection به‌صورت جدول به Drive ایجاد می‌کند. تکالیف را می‌توان از برگه «تکالیف» شروع کرد.

کاربردبازگشتی‌ها
Export.table.toDrive(collection, description, folder, fileNamePrefix, fileFormat, selectors, maxVertices, priority)
متغیر مستقلنوعجزئیات
collectionFeatureCollectionمجموعه عارضه برای صادر کردن.
descriptionرشته، اختیارینام تکلیف قابل‌خواندن برای انسان. می‌تواند شامل حروف، اعداد، -، _ (بدون فاصله) باشد. به‌طور پیش‌فرض «myExportTableTask» است.
folderرشته، اختیاریپوشه Google Drive که فایل صادرشده در آن قرار خواهد گرفت. توجه: (الف) اگر نام پوشه در هر سطحی وجود داشته باشد، خروجی در آن نوشته می‌شود، (ب) اگر نام‌های پوشه تکراری وجود داشته باشد، خروجی در پوشه‌ای که اخیراً اصلاح شده است نوشته می‌شود، (ج) اگر نام پوشه وجود نداشته باشد، پوشه جدیدی در ریشه ایجاد می‌شود، و (د) نام‌های پوشه با جداکننده‌ها (مثلاً «path/to/file») به‌عنوان رشته‌های دقیق تفسیر می‌شوند، نه مسیرهای سیستم. به‌طور پیش‌فرض به ریشه Drive می‌رود.
fileNamePrefixرشته، اختیاریپیشوند نام فایل. می‌تواند شامل حروف، اعداد، -، _ (بدون فاصله) باشد. به‌طور پیش‌فرض به توضیحات می‌رود.
fileFormatرشته، اختیاریقالب برونداد: «CSV» (پیش‌فرض)، «GeoJSON»،‏ «KML»،‏ «KMZ»، یا «SHP»، یا «TFRecord».
selectorsList[String]|String، اختیاریفهرستی از دارایی‌ها برای گنجاندن در صادر کردن؛ یا یک رشته تکی با نام‌های جداشده با کاما یا فهرستی از رشته‌ها.
maxVerticesشماره، اختیاریحداکثر تعداد رأس‌های برش‌نخورده در هر هندسه؛ هندسه‌هایی که رأس‌های بیشتری دارند به قطعاتی کوچک‌تر از این اندازه برش داده می‌شوند.
priorityشماره، اختیاریاولویت تکلیف در پروژه. تکالیف با اولویت بالاتر زودتر زمان‌بندی می‌شوند. باید عدد صحیحی بین ۰ و ۹۹۹۹ باشد. پیش‌فرض ۱۰۰ است.

مثال‌ها

ویرایشگر کد (جاوا اسکریپت)

// A Sentinel-2 surface reflectance image.
var img = ee.Image('COPERNICUS/S2_SR_HARMONIZED/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

برای اطلاعات درباره Python API و استفاده از geemap برای توسعه تعاملی، به صفحه محیط Python مراجعه کنید.

import ee
import geemap.core as geemap

Colab (Python)

# A Sentinel-2 surface reflectance image.
img = ee.Image('COPERNICUS/S2_SR_HARMONIZED/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()