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?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityYou 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.