ee.Blob.string

以字符串形式返回 blob 的内容。

用法返回
Blob.string(encoding)字符串
参数类型详细信息
此:blobBlob
encoding字符串,默认值:null解码 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 API 和如何使用 geemap 进行交互式开发,请参阅 Python 环境页面。

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"