테이블 및 벡터 데이터 내보내기

Export.table를 사용하여 FeatureCollection를 CSV, SHP(셰이프파일), GeoJSON, KML, KMZ 또는 TFRecord로 내보낼 수 있습니다. FeatureCollection는 벡터를 나타내거나 단순히 데이터 테이블을 나타낼 수 있습니다. 후자의 경우 컬렉션의 지형지물에 null 도형이 포함됩니다.

일부 파일 형식을 사용할 때는 다음과 같은 추가 제약조건에 유의하세요.

  • KML: KML 파일로 내보낸 FeatureCollection에는 모든 도형이 투영되지 않은(WGS84) 좌표로 변환됩니다.
  • SHP: Shapefile로 내보낸 FeatureCollection에는 동일한 도형 유형 및 투영이 있는 지형지물이 포함되어야 하며 Shapefile 크기 제한 내에 맞아야 합니다. 열 이름은 10자(영문 기준) 이하로 잘리며, 이로 인해 중복된 열 이름이 생성되지 않아야 합니다.
  • TFRecord: 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'
});

Python 설정

Python API 및 대화형 개발을 위한 geemap 사용에 대한 자세한 내용은 Python 환경 페이지를 참조하세요.

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',
});

Python 설정

Python API 및 대화형 개발을 위한 geemap 사용에 대한 자세한 내용은 Python 환경 페이지를 참조하세요.

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자(영문 기준)

BigQuery로 내보내기

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
});

Python 설정

Python API 및 대화형 개발을 위한 geemap 사용에 대한 자세한 내용은 Python 환경 페이지를 참조하세요.

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로 이동

FeatureCollection를 Drive 계정으로 내보내려면 Export.table.toDrive()를 사용합니다. 예를 들면 다음과 같습니다.

코드 편집기(JavaScript)

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

Python 설정

Python API 및 대화형 개발을 위한 geemap 사용에 대한 자세한 내용은 Python 환경 페이지를 참조하세요.

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'
});

Python 설정

Python API 및 대화형 개발을 위한 geemap 사용에 대한 자세한 내용은 Python 환경 페이지를 참조하세요.

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'로 설정됩니다.