Export.table.toDrive

FeatureCollection をテーブルとしてドライブにエクスポートするバッチタスクを作成します。タスクは [タスク] タブから開始できます。

用途戻り値
Export.table.toDrive(collection, description, folder, fileNamePrefix, fileFormat, selectors, maxVertices, priority)
引数タイプ詳細
collectionFeatureCollectionエクスポートするフィーチャー コレクション。
description文字列、省略可人が読める形式のタスク名。英字、数字、-、_ を使用できます(スペースは使用できません)。デフォルトは「myExportTableTask」です。
folder文字列、省略可エクスポートが保存される Google ドライブ フォルダ。注: (a)フォルダ名が任意のレベルに存在する場合、出力はそのフォルダに書き込まれます。(b)重複するフォルダ名が存在する場合、出力は最後に変更されたフォルダに書き込まれます。(c)フォルダ名が存在しない場合、ルートに新しいフォルダが作成されます。(d)区切り文字を含むフォルダ名(「path/to/file」など)は、システムパスではなくリテラル文字列として解釈されます。デフォルトはドライブのルートです。
fileNamePrefix文字列、省略可ファイル名の接頭辞。英字、数字、-、_ を使用できます(スペースは使用できません)。デフォルトは説明です。
fileFormat文字列、省略可出力形式: 「CSV」(デフォルト)、「GeoJSON」、「KML」、「KMZ」、「SHP」、「TFRecord」。
selectorsList<String>|String(省略可)エクスポートに含めるプロパティのリスト。カンマ区切りの名前を含む単一の文字列または文字列のリスト。
maxVertices数値、省略可ジオメトリあたりの未カット頂点の最大数。頂点数がこの数を超えるジオメトリは、このサイズより小さいピースにカットされます。
priority数値、省略可プロジェクト内のタスクの優先度。優先度の高いタスクは、より早くスケジュールされます。0 ~ 9999 の整数を指定してください。デフォルトは 100 です。

コードエディタ(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'
});

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/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()