1

I was using a Google Earth Engine(GEE) account and the corresponding Google Drive storage was very less for me.I extended the drive storage for my another Google account and activated GEE for that account. I had lots of data within different assets of previous account. For transferring them I'm following these procedure:

  1. Share each asset with my second account.
  2. Using ee.Image()/ee.FeatureCollection() etc. Is there any way to transfer an entire Assets at a time rather than transferring each files within it one by one?

1 Answer 1

3

Yes, one way is to use the earthengine python API. First create a new folder through the code editor for your destination folder.

Then you can run this peace of code in a jupyter notebook (or colab)

import ee
ee.Initialize()

# folder from where to copy
src_folder = "projects/earthengine-legacy/assets/users/username/old_folder"
# folder where to copy
dest_folder = "projects/earthengine-legacy/assets/users/username/new_folder"

# get all assets in the folder
assets = ee.data.listAssets({'parent': src_folder})

# loop through assets and copy them one by one to the new destination
for asset in assets['assets']:
    # construct destination path
    new_asset = dest_folder + '/' + asset['id'].split('/')[-1]
    # copy to destination
    ee.data.copyAsset(asset['id'], new_asset, True)
    # delete source asset
    ee.data.deleteAsset(asset['id'])

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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