Export.table.toDrive

Membuat tugas batch untuk mengekspor FeatureCollection sebagai tabel ke Drive. Tugas dapat dimulai dari tab Tasks.

PenggunaanHasil
Export.table.toDrive(collection, description, folder, fileNamePrefix, fileFormat, selectors, maxVertices, priority)
ArgumenJenisDetail
collectionFeatureCollectionKoleksi fitur yang akan diekspor.
descriptionString, opsionalNama tugas yang dapat dibaca manusia. Dapat berisi huruf, angka, -, _ (tanpa spasi). Defaultnya adalah "myExportTableTask".
folderString, opsionalFolder Google Drive tempat hasil ekspor akan berada. Catatan: (a) jika nama folder ada di tingkat mana pun, output akan ditulis ke folder tersebut, (b) jika ada nama folder duplikat, output akan ditulis ke folder yang terakhir diubah, (c) jika nama folder tidak ada, folder baru akan dibuat di root, dan (d) nama folder dengan pemisah (misalnya, 'path/to/file') ditafsirkan sebagai string literal, bukan jalur sistem. Default-nya adalah root Drive.
fileNamePrefixString, opsionalAwalan nama file. Dapat berisi huruf, angka, -, _ (tanpa spasi). Default-nya adalah deskripsi.
fileFormatString, opsionalFormat output: "CSV" (default), "GeoJSON", "KML", "KMZ", "SHP", atau "TFRecord".
selectorsList<String>|String, opsionalDaftar properti yang akan disertakan dalam ekspor; berupa string tunggal dengan nama yang dipisahkan koma atau daftar string.
maxVerticesNomor, opsionalJumlah maksimum verteks yang tidak dipotong per geometri; geometri dengan lebih banyak verteks akan dipotong menjadi beberapa bagian yang lebih kecil dari ukuran ini.
priorityNomor, opsionalPrioritas tugas dalam project. Tugas dengan prioritas lebih tinggi dijadwalkan lebih awal. Harus berupa bilangan bulat antara 0 dan 9999. Setelan defaultnya adalah 100.

Contoh

Code Editor (JavaScript)

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

Penyiapan Python

Lihat halaman Lingkungan Python untuk mengetahui informasi tentang Python API dan penggunaan geemap untuk pengembangan interaktif.

import ee
import geemap.core as geemap

Colab (Python)

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