ee.Blob.string

以字串形式傳回 Blob 的內容。

用量傳回
Blob.string(encoding)字串
引數類型詳細資料
這個:blobBlob
encoding字串,預設值為空值解碼 Blob 時使用的字元集編碼。 選項包括但不限於「US-ASCII」、「UTF-8」和「UTF-16」。

範例

程式碼編輯器 (JavaScript)

// Parse a SpatioTemporal Asset Catalog (STAC) entry from Google Cloud
// Storage (GCS). This is a non-traditional use of ee.Blob.
var url = 'gs://ee-docs-demos/vector/geojson/point.json';
var blob = ee.Blob(url);
var entry = ee.Dictionary(blob.string().decodeJSON());
print(entry);  // Point (1.00, 2.00)...
print(entry.get('a_field'));  // "a demo field"

Python 設定

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

import ee
import geemap.core as geemap

Colab (Python)

# Parse a SpatioTemporal Asset Catalog (STAC) entry from Google Cloud
# Storage (GCS). This is a non-traditional use of ee.Blob.
url = 'gs://ee-docs-demos/vector/geojson/point.json'
blob = ee.Blob(url)
entry = ee.Dictionary(blob.string().decodeJSON())
print(entry.getInfo())  # Point (1.00, 2.00)...
print(entry.get('a_field').getInfo())  # "a demo field"