Pengumuman: Semua project nonkomersial yang terdaftar untuk menggunakan Earth Engine sebelum
15 April 2025 harus
memverifikasi kelayakan nonkomersial untuk mempertahankan akses. Jika Anda belum melakukan verifikasi hingga 26 September 2025, akses Anda mungkin ditangguhkan.
Export.table.toDrive
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Membuat tugas batch untuk mengekspor FeatureCollection sebagai tabel ke Drive. Tugas dapat dimulai dari tab Tasks.
Penggunaan | Hasil |
---|
Export.table.toDrive(collection, description, folder, fileNamePrefix, fileFormat, selectors, maxVertices, priority) | |
Argumen | Jenis | Detail |
---|
collection | FeatureCollection | Koleksi fitur yang akan diekspor. |
description | String, opsional | Nama tugas yang dapat dibaca manusia. Dapat berisi huruf, angka, -, _ (tanpa spasi). Defaultnya adalah "myExportTableTask". |
folder | String, opsional | Folder 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. |
fileNamePrefix | String, opsional | Awalan nama file. Dapat berisi huruf, angka, -, _ (tanpa spasi). Default-nya adalah deskripsi. |
fileFormat | String, opsional | Format output: "CSV" (default), "GeoJSON", "KML", "KMZ", "SHP", atau "TFRecord". |
selectors | List<String>|String, opsional | Daftar properti yang akan disertakan dalam ekspor; berupa string tunggal dengan nama yang dipisahkan koma atau daftar string. |
maxVertices | Nomor, opsional | Jumlah maksimum verteks yang tidak dipotong per geometri; geometri dengan lebih banyak verteks akan dipotong menjadi beberapa bagian yang lebih kecil dari ukuran ini. |
priority | Nomor, opsional | Prioritas 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()
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-25 UTC.
[null,null,["Terakhir diperbarui pada 2025-07-25 UTC."],[],["This function exports a FeatureCollection as a table to Google Drive. Key actions include specifying the `collection`, task `description`, target `folder`, `fileNamePrefix`, and `fileFormat` (CSV, GeoJSON, KML, KMZ, SHP, or TFRecord). Optional actions include specifying `selectors` to limit exported properties, setting `maxVertices` to manage geometry size, and `priority` to control task scheduling. Multiple examples show how to export sampled image data to Drive in various formats.\n"]]