ee.Algorithms.ObjectType

傳回代表指定物件類型的字串。

用量傳回
ee.Algorithms.ObjectType(value)字串
引數類型詳細資料
value物件,預設值:null要取得類型的物件。

範例

程式碼編輯器 (JavaScript)

print(ee.Algorithms.ObjectType(1));  // The string "Integer"
print(ee.Algorithms.ObjectType(ee.Number(1)));  // The string "Integer"
print(ee.Algorithms.ObjectType(ee.String('a string')));  // The string "String"
print(ee.Algorithms.ObjectType(ee.List([1, 'a string'])));  // The string "List"

// ee.Algorithms.ObjectType can be used to get the type of properties
// of ee.Image or ee.Feature objects.
var feature = ee.Feature(
  null,  // No need for geometry in this example.
  {
    'int': 42,
    'int8': ee.Number(-3).int8(),
  });

// The string "Integer"
print('int:', ee.Algorithms.ObjectType(feature.get('int')));
// The string "Long"
print('int8:', ee.Algorithms.ObjectType(feature.get('int8')));

Python 設定

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

import ee
import geemap.core as geemap

Colab (Python)

print(ee.Algorithms.ObjectType(ee.Number(1)).getInfo())  # The string "Integer"
print(
    ee.Algorithms.ObjectType(ee.String('a string')).getInfo()
)  # The string "String"
print(
    ee.Algorithms.ObjectType(ee.List([1, 'a string'])).getInfo()
)  # The string "List"

# ee.Algorithms.ObjectType can be used to get the type of properties
# of ee.Image or ee.Feature objects.
feature = ee.Feature(
    None,  # No need for geometry in this example.
    {
        'int': 42,
        'int8': ee.Number(-3).int8(),
    }
)

# The string "Integer"
print('int:', ee.Algorithms.ObjectType(feature.get('int')).getInfo())
# The string "Long"
print('int8:', ee.Algorithms.ObjectType(feature.get('int8')).getInfo())