2

I have several images stored in a Google Cloud bucket that I would like to import into Google Earth Engine. In the GEE documentation, I can see that Earth Engine can ingest single images from a Bucket using ee.Image.loadGeoTIFF() but I have too many images for this to be feasible.

Is there some way import all images in a Bucket as an imageCollection, or to loop through all possible names for images to and add them one-by-one to an imageCollection?

Would it be faster to just download from the bucket and separately upload to Earth Engine?

2 Answers 2

3

You can add them to a collection, but only by calling the createAsset endpoint yourself. https://developers.google.com/earth-engine/Earth_Engine_asset_from_cloud_geotiff

2

Six years later and Noel's answer is still true. See this link for an example: https://developers.google.com/earth-engine/guides/ic_creating

// All the GeoTiffs are in this folder.
var uriBase = 'gs://gcp-public-data-landsat/LC08/01/001/002/' +
    'LC08_L1GT_001002_20160817_20170322_01_T2/';

// List of URIs, one for each band.
var uris = ee.List([
  uriBase + 'LC08_L1GT_001002_20160817_20170322_01_T2_B2.TIF',
  uriBase + 'LC08_L1GT_001002_20160817_20170322_01_T2_B3.TIF',
  uriBase + 'LC08_L1GT_001002_20160817_20170322_01_T2_B4.TIF',
  uriBase + 'LC08_L1GT_001002_20160817_20170322_01_T2_B5.TIF',
]);

// Make a collection from the list of images.
var images = uris.map(ee.Image.loadGeoTIFF);
var collection = ee.ImageCollection(images);

// Get an RGB image from the collection of bands.
var rgb = collection.toBands().rename(['B2', 'B3', 'B4', 'B5']);
Map.centerObject(rgb);
Map.addLayer(rgb, {bands: ['B4', 'B3', 'B2'], min: 0, max: 20000}, 'rgb');
1
  • 1
    Tested that in Python I sometimes need to do images = uris.map(lambda uri: ee.Image.loadGeoTIFF(uri)) to get rid of the error of AttributeError: 'ApiFunction' object has no attribute 'name'.
    – Fei Yao
    Dec 13, 2022 at 14:22

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.