ee.Blob.string

  • The Blob.string() method returns the contents of a blob as a String.

  • An optional encoding can be specified to decode the blob's content using a particular character set.

  • The method can be used to parse data from various sources, such as Google Cloud Storage, as demonstrated in the examples.

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 
 ()) 
 display 
 ( 
 entry 
 ) 
 # Point (1.00, 2.00)... 
 display 
 ( 
 entry 
 . 
 get 
 ( 
 'a_field' 
 )) 
 # "a demo field" 
Design a Mobile Site
View Site in Mobile | Classic
Share by: