Tablo ve Vektör Verilerini Dışa Aktarma

FeatureCollection dosyasını Export.table kullanarak CSV, SHP (şekil dosyası), GeoJSON, KML, KMZ veya TFRecord biçiminde dışa aktarabilirsiniz. FeatureCollection, vektörleri veya yalnızca bir veri tablosunu temsil edebilir. İkinci durumda, koleksiyondaki özellikler null geometriye sahip olur.

Bazı dosya biçimleriyle çalışırken aşağıdakiler gibi ek kısıtlamalar olduğunu unutmayın:

  • KML: KML dosyasına aktarılan bir FeatureCollection dosyasında tüm geometriler projelendirilmemiş (WGS84) koordinatlara dönüştürülür.
  • SHP: Shapefile'e aktarılan bir FeatureCollection, aynı geometri türüne ve projeksiyona sahip özellikler içermeli ve Shapefile boyut sınırlarına sığmalıdır. Sütun adları 10 karakter veya daha kısa olacak şekilde kısaltılır. Bu işlem, yinelenen sütun adları oluşturmamalıdır.
  • TFRecord: Bu sayfaya bakın.

Cloud Storage'a aktarma

FeatureCollection dosyasını Cloud Storage'a aktarmak için Export.table.toCloudStorage()'u kullanın. Örneğin, daha önce tanımlanan features değerini kullanarak:

Kod Düzenleyici (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'
});

Python kurulumu

Python API'si ve etkileşimli geliştirme için geemap kullanımı hakkında bilgi edinmek üzere Python Ortamı sayfasına bakın.

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

Öğe

Bir FeatureCollection öğesini Earth Engine öğesi olarak dışa aktarmak için Export.table.toAsset() işlevini kullanın. Örneğin, daha önce tanımlanan features değerini kullanarak:

Kod Düzenleyici (JavaScript)

// Export an ee.FeatureCollection as an Earth Engine asset.
Export.table.toAsset({
  collection: features,
  description:'exportToTableAssetExample',
  assetId: 'exampleAssetId',
});

Python kurulumu

Python API'si ve etkileşimli geliştirme için geemap kullanımı hakkında bilgi edinmek üzere Python Ortamı sayfasına bakın.

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 tablo öğelerinin boyutu ve şekliyle ilgili birkaç sınırlama vardır:

  • En fazla 100 milyon özellik
  • Maksimum 1.000 mülk (sütun)
  • Her satırın geometrisi için maksimum 100.000 köşe
  • Dize değeri başına en fazla 100.000 karakter

BigQuery'ye

Export.table.toBigQuery()'i kullanarak bir FeatureCollection'yi BigQuery tablosuna aktarabilirsiniz. Bu sayede Earth Engine verilerinizi BigQuery'de bulunan diğer verilerle ve araçlarla entegre edebilirsiniz. Daha fazla bilgi için BigQuery'ye veri aktarma kılavuzuna bakın.

Kod Düzenleyici (JavaScript)

Export.table.toBigQuery({
  collection: features,
  table: 'myproject.mydataset.mytable',
  description: 'put_my_data_in_bigquery',
  append: true,
  overwrite: false
});

Python kurulumu

Python API'si ve etkileşimli geliştirme için geemap kullanımı hakkında bilgi edinmek üzere Python Ortamı sayfasına bakın.

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

Drive'a

FeatureCollection dosyasını Drive hesabınıza aktarmak için Export.table.toDrive()'u kullanın. Örneğin:

Kod Düzenleyici (JavaScript)

// Export the FeatureCollection to a KML file.
Export.table.toDrive({
  collection: features,
  description:'vectorsToDriveExample',
  fileFormat: 'KML'
});

Python kurulumu

Python API'si ve etkileşimli geliştirme için geemap kullanımı hakkında bilgi edinmek üzere Python Ortamı sayfasına bakın.

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

Coğrafi verileri işlemek için çıkış biçiminin KML olarak belirtildiğini unutmayın (SHP, geometri içeren bir tabloyu dışa aktarmak için de uygundur). Coğrafi bilgi içermeyen yalnızca bir veri tablosunu dışa aktarmak için özellikleri CSV biçiminde boş geometriyle dışa aktarın. Aşağıda, uzun süren bir azaltmanın sonuçlarını almak için Export.table.toDrive() işlevinin nasıl kullanılacağı gösterilmektedir:

Kod Düzenleyici (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'
});

Python kurulumu

Python API'si ve etkileşimli geliştirme için geemap kullanımı hakkında bilgi edinmek üzere Python Ortamı sayfasına bakın.

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

Çıktıda geometri olmadığı için bu örnekte biçimin "CSV" olarak ayarlandığını unutmayın.