Export.table
を使用して、FeatureCollection
を CSV、SHP(シェイプファイル)、GeoJSON、KML、KMZ、TFRecord としてエクスポートできます。FeatureCollection
はベクトルを表すことも、単なるデータの表を表すこともできます。後者の場合、コレクション内の特徴には null ジオメトリが設定されます。
一部のファイル形式を使用する場合は、次の制約に注意してください。
- KML: KML ファイルにエクスポートされた
FeatureCollection
では、すべてのジオメトリが非投影(WGS84)座標に変換されます。 - SHP: シェイプファイルにエクスポートされる
FeatureCollection
には、同じジオメトリ タイプと投影を持つ特徴が含まれ、シェイプファイルのサイズの上限内に収まる必要があります。列名は 10 文字以下に切り捨てられます。これにより、重複する列名が作成されないようにする必要があります。 - 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' });
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', });
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 テーブル アセットのサイズと形状にはいくつかの制限があります。
- 最大 1 億個の特徴
- 最大 1,000 個のプロパティ(列)
- 各行のジオメトリの最大頂点数: 100,000
- 文字列値あたりの最大文字数: 100,000 文字
のエクスポート
Export.table.toBigQuery()
を使用して、FeatureCollection
を BigQuery テーブルにエクスポートできます。これにより、Earth Engine データを BigQuery で利用可能な他のデータやツールと統合できます。詳細については、BigQuery へのエクスポート ガイドをご覧ください。
コードエディタ(JavaScript)
Export.table.toBigQuery({ collection: features, table: 'myproject.mydataset.mytable', description: 'put_my_data_in_bigquery', append: true, overwrite: false });
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()
ドライブに移動
FeatureCollection
をドライブ アカウントにエクスポートするには、Export.table.toDrive()
を使用します。次に例を示します。
コードエディタ(JavaScript)
// Export the FeatureCollection to a KML file. Export.table.toDrive({ collection: features, description:'vectorsToDriveExample', fileFormat: 'KML' });
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 も適しています)。地理情報のないデータ表のみをエクスポートするには、null ジオメトリを持つ対象物を 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' });
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 に設定されています。