Earth Engine 即將推出
非商業用途的配額級別 ,以便保護共用運算資源,並確保所有使用者都能享有穩固效能。所有非商業用途的專案都必須在
2026 年 4 月 27 日 前選取配額級別,否則屆時會預設為「社群」級別。在
2026 年 4 月 27 日 ,所有專案 (無論選取級別的日期為何) 的級別配額都會生效。
瞭解詳情 。
Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
提供意見
ee.ImageCollection.toDictionary
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
從特徵擷取屬性做為字典。
用量 傳回 ImageCollection. toDictionary (properties )字典
引數 類型 詳細資料 這個:element 元素 要從中擷取屬性的特徵。 properties清單,預設值為空值 要擷取的屬性清單。預設為所有非系統屬性。
範例
程式碼編輯器 (JavaScript)
// A contrived, empty image collection for simple demonstration.
var col = ee . ImageCollection ([]);
print ( 'Collection without properties' , col );
// Set collection properties using a dictionary.
col = col . set ({
project_name : 'biomass_tracking' ,
project_id : 3 ,
plot_ids : ee . Array ([ 7 , 11 , 20 ])
});
// Set collection properties using a series of key-value pairs.
col = col . set ( 'project_year' , 2018 ,
'rgb_vis' , 'false_color' );
print ( 'Collection with properties' , col );
// Get a dictionary of collection property keys and values.
print ( 'Property keys and values (ee.Dictionary)' , col . toDictionary ());
// Get the value of a collection property. To use the result of
// ee.ImageCollection.get in further computation, you need to cast it to the
// appropriate class, for example, ee.Number(result) or ee.String(result).
print ( 'Project ID (ambiguous object)' , col . get ( 'project_id' ));
// Get the value of a string collection property as an ee.String object.
print ( 'Project name (ee.String)' , col . getString ( 'project_name' ));
// Get the value of a numeric collection property as an ee.Number object.
print ( 'Project year (ee.Number)' , col . getNumber ( 'project_year' ));
// Get the value of an ee.Array collection property as an ee.Array object.
print ( 'Plot IDs (ee.Array)' , col . getArray ( 'plot_ids' ));
Python 設定
請參閱
Python 環境 頁面,瞭解 Python API 和如何使用 geemap 進行互動式開發。
import ee
import geemap.core as geemap
Colab (Python)
# A contrived, empty image collection for simple demonstration.
col = ee . ImageCollection ([])
display ( 'Collection without properties:' , col )
# Set collection properties using a dictionary.
col = col . set ({
'project_name' : 'biomass_tracking' ,
'project_id' : 3 ,
'plot_ids' : ee . Array ([ 7 , 11 , 20 ])
})
# Set collection properties using a series of key-value pairs.
col = col . set ( 'project_year' , 2018 ,
'rgb_vis' , 'false_color' )
display ( 'Collection with properties:' , col )
# Get a dictionary of collection property keys and values.
display ( 'Property keys and values (ee.Dictionary):' , col . toDictionary ())
# Get the value of a collection property. To use the result of
# ee.ImageCollection.get in further computation, you need to cast it to the
# appropriate class, for example, ee.Number(result) or ee.String(result).
display ( 'Project ID (ambiguous object):' , col . get ( 'project_id' ))
# Get the value of a string collection property as an ee.String object.
display ( 'Project name (ee.String):' , col . getString ( 'project_name' ))
# Get the value of a numeric collection property as an ee.Number object.
display ( 'Project year (ee.Number):' , col . getNumber ( 'project_year' ))
# Get the value of an ee.Array collection property as an ee.Array object.
display ( 'Plot IDs (ee.Array):' , col . getArray ( 'plot_ids' ))
提供意見
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權 ,程式碼範例則為阿帕契 2.0 授權 。詳情請參閱《Google Developers 網站政策 》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-10-30 (世界標準時間)。
想進一步說明嗎?
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-10-30 (世界標準時間)。"],[],["The `ImageCollection.toDictionary()` method extracts properties from a feature, returning them as a dictionary. You must provide a list of `properties`; otherwise, it will default to all non-system properties. Properties can be added to an image collection with `set()`. Individual property values can be retrieved using `get()`, `getString()`, `getNumber()`, or `getArray()`, and then must be cast into the appropriate data type.\n"]]