I am trying to load JSON multipolygon directly from a GCP bucket file. It actually works if the JSON is not too big, but does not work if the file become bigger. Here is my code: https://code.earthengine.google.com/b77179ab2b3518487f685ed2aec0e735

//var url = 'gs://test-public-gcp/bigfile.json';
var url = 'gs://test-public-gcp/smallfile.json';
var blob = ee.Blob(url);
var string = blob.string();
var json = ee.Deserializer.fromJSON(string.getInfo());
var polygon = ee.Geometry(json);

Is there a size limit for ee.Deserializer.fromJSON ? The small file is about 10 times smaller than the big file, and it loads in 2-3 seconds, the bigfile never loads (not even in 5 minutes).

A solution could be to split the bigfile into small files, but then I would need to list all files in a bucket folder to retrieve them all, is there a function that can list the files of a gcp bucket?

I could also import a shapefile from gcp bucket using startTableIngestion, but it does not work in the public app (since it creates an asset), is there a way to make it work in public app?

Overall, I am looking for any solution that would allow me to import a shapefile / JSON polygon as a new layer, directly from the public app. And using only function available in the GEE online code editor.

1 Answer 1


Turns out I solved my problem using:

var url = 'gs://test-public-gcp/bigfile2.txt';
var blob = ee.Blob(url); 
var geom = blob.string().decodeJSON();
var polygon = ee.Geometry.MultiPolygon(geom); 

And my bigfile2.txtis now just a file with the coordinates, like [[[[150.33646898037068, -28.55949624210206],[150.33646898037068, -28.6312401012765],[150.4367192245113, -28.58723496827538],[150.40032701259724, -28.535369667334407]]],[[[150.47929124599568, -28.558290044640838],[150.49920396572224, -28.627623936423543],[150.54520921474568, -28.59145543753039],[150.54246263271443, -28.5480368082393]]]]

Whether there exist a better solution remains an open question, but it works!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.