1

I am trying to create an asset folder using

ee.data.createFolder()

But I get the error:

AttributeError: module 'ee.data' has no attribute 'createFolder'

How do I create a folder using the python api?

1 Answer 1

1

You have to use the ee.data.createAsset() method, like so:

import ee
ee.Initialize()
ee.data.createAsset({'type': 'ImageCollection'}, 'users/[your-username]/test-folder')

Note that the type is different whether you're using the Cloud API or not. From the docs:

Creates an asset from a JSON value.

To create an empty image collection or folder, pass in a "value" object with a "type" key whose value is "ImageCollection" or "Folder". If you are using the Cloud API, use "IMAGE_COLLECTION" or "FOLDER".

Args: value: An object describing the asset to create or a JSON string with the already-serialized value for the new asset. opt_path: An optional desired ID, including full path. opt_properties: The keys and values of the properties to set on the created asset.

Returns: A description of the saved asset, including a generated ID.

Your Answer

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

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