ee.FeatureCollection.getDownloadURL

取得下載網址。存取網址時,系統會以其中一種格式下載 FeatureCollection。

如果指定了回呼,則會傳回下載網址或未定義。

用量傳回
FeatureCollection.getDownloadURL(format, selectors, filename, callback)Object|String
引數類型詳細資料
這個:featurecollectionFeatureCollectionFeatureCollection 執行個體。
format字串 (選用)下載格式,可以是下列其中一種: 「csv」、「json」、「geojson」、「kml」、「kmz」(「json」會輸出 GeoJSON)。如未指定,則預設為「csv」。
selectorsList<String>|String,選用用於選取要下載屬性的特徵屬性名稱。如未指定,系統會納入所有屬性。
filename字串 (選用)要下載的檔案名稱,系統預設會附加副檔名。如未指定,則預設為「table」。
callback函式 (選用)選用回呼。如未提供,系統會同步發出呼叫。

範例

程式碼編輯器 (JavaScript)

// FeatureCollection of power plants in Belgium.
var fc = ee.FeatureCollection('WRI/GPPD/power_plants')
            .filter('country_lg == "Belgium"');

// Get a download URL for the FeatureCollection.
var downloadUrl = fc.getDownloadURL({
  format: 'CSV',
  selectors: ['capacitymw', 'fuel1'],
  filename: 'belgian_power_plants'
});
print('URL for downloading FeatureCollection as CSV', downloadUrl);

Python 設定

請參閱 Python 環境頁面,瞭解 Python API 和如何使用 geemap 進行互動式開發。

import ee
import geemap.core as geemap

Colab (Python)

# FeatureCollection of power plants in Belgium.
fc = ee.FeatureCollection('WRI/GPPD/power_plants').filter(
    'country_lg == "Belgium"')

# Get a download URL for the FeatureCollection.
download_url = fc.getDownloadURL(**{
  'filetype': 'CSV',
  'selectors': ['capacitymw', 'fuel1'],
  'filename': 'belgian_power_plants',
})
print('URL for downloading FeatureCollection as CSV:', download_url)