お知らせ:
2025 年 4 月 15 日より前に Earth Engine の使用を登録したすべての非商用プロジェクトは、Earth Engine へのアクセスを維持するために
非商用目的での利用資格を確認する必要があります。
ee.Blob.string
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
blob のコンテンツを文字列として返します。
用途 | 戻り値 |
---|
Blob.string(encoding) | 文字列 |
引数 | タイプ | 詳細 |
---|
これ: blob | Blob | |
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"
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-26 UTC。
[null,null,["最終更新日 2025-07-26 UTC。"],[[["\u003cp\u003e\u003ccode\u003eBlob.string()\u003c/code\u003e returns the contents of a blob as a String, optionally decoding it using a specified character set encoding.\u003c/p\u003e\n"],["\u003cp\u003eThis method can be used to process data stored in blobs, such as parsing JSON or text files from cloud storage.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eencoding\u003c/code\u003e parameter is optional and defaults to null, allowing you to specify character sets like 'US-ASCII', 'UTF-8', and 'UTF-16' for decoding.\u003c/p\u003e\n"],["\u003cp\u003eExamples demonstrate the use of \u003ccode\u003eBlob.string()\u003c/code\u003e to read and parse a GeoJSON file from Google Cloud Storage using both JavaScript and Python APIs.\u003c/p\u003e\n"]]],["The `Blob.string()` method retrieves the content of a blob as a string. It accepts an optional `encoding` argument (defaulting to `null`) to specify the character set for decoding, such as 'US-ASCII', 'UTF-8', or 'UTF-16'. The return type is a String. Example usages demonstrate fetching a JSON file from Google Cloud Storage using this function to get a SpatioTemporal Asset Catalog (STAC) entry as a decoded JSON.\n"],null,["# ee.Blob.string\n\nReturns the contents of the blob as a String.\n\n\u003cbr /\u003e\n\n| Usage | Returns |\n|-----------------------------|---------|\n| Blob.string`(`*encoding*`)` | String |\n\n| Argument | Type | Details |\n|--------------|-----------------------|---------------------------------------------------------------------------------------------------------------------------------------|\n| this: `blob` | Blob | |\n| `encoding` | String, default: null | The character set encoding to use when decoding the blob. Options include, but are not limited to, 'US-ASCII', 'UTF-8', and 'UTF-16'. |\n\nExamples\n--------\n\n### Code Editor (JavaScript)\n\n```javascript\n// Parse a SpatioTemporal Asset Catalog (STAC) entry from Google Cloud\n// Storage (GCS). This is a non-traditional use of ee.Blob.\nvar url = 'gs://ee-docs-demos/vector/geojson/point.json';\nvar blob = ee.Blob(url);\nvar entry = ee.Dictionary(blob.string().decodeJSON());\nprint(entry); // Point (1.00, 2.00)...\nprint(entry.get('a_field')); // \"a demo field\"\n```\nPython setup\n\nSee the [Python Environment](/earth-engine/guides/python_install) page for information on the Python API and using\n`geemap` for interactive development. \n\n```python\nimport ee\nimport geemap.core as geemap\n```\n\n### Colab (Python)\n\n```python\n# Parse a SpatioTemporal Asset Catalog (STAC) entry from Google Cloud\n# Storage (GCS). This is a non-traditional use of ee.Blob.\nurl = 'gs://ee-docs-demos/vector/geojson/point.json'\nblob = ee.Blob(url)\nentry = ee.Dictionary(blob.string().decodeJSON())\nprint(entry.getInfo()) # Point (1.00, 2.00)...\nprint(entry.get('a_field').getInfo()) # \"a demo field\"\n```"]]