ee.Blob.string
Stay organized with collections
Save and categorize content based on your preferences.
Returns the contents of the blob as a String.
Usage | Returns | Blob.string(encoding) | String |
Argument | Type | Details | this: blob | Blob | |
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'. |
Examples
Code Editor (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 setup
See the
Python Environment page for information on the Python API and using
geemap
for interactive development.
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"
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-13 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]