0

I'm looking fo add a List of Strings value to properties of an image collection in google earth similar to Copernicus CORINE Land Cover: https://developers.google.com/earth-engine/datasets/catalog/COPERNICUS_CORINE_V20_100m#image-properties

I tried this code:

var assetId = 'your-image-collection-id'

var lis = "one"

// Update the properties of the asset in Earth Engine.
var task =ee.data.setAssetProperties(assetId, {
'prova': lis})

It works but It doesn't accept list

then I tried this other code:

// ID dell'Image Collection 
var collectionId = 'your-image-collection-id'; 
  // Recupera l'Image Collection 
var collection = ee.ImageCollection(collectionId); 
  // Crea un oggetto JSON che rappresenta le proprietà da inserire 
var newProperties = { 'property_name_1': ['one' , 'two', 'three' ,   ] }; 
  // Aggiorna le proprietà dell'Image Collection 
var updatedCollection = collection.set(newProperties); 
  // Salva le proprietà aggiornate sull'Asset Earth Engine 
var task = ee.data.updateAsset({ assetId: collectionId, properties: newProperties }); 
  // Verifica lo stato della task 
var status = task.status();

and this is the error:

Asset 'projects/earthengine-public/assets/[object Object]' does not exist or doesn't allow this operation

but the id is correct and the asset is mine.

Any suggestion is welcome

1 Answer 1

1

While it's hard to tell for sure without accessing the actual asset, it looks like you are mixing server-side and client-side functions, which is why it is registering the id as [object Object] rather than its actual value. You may need to do an explicit cast, use getInfo() or modify your script to use only server-side functions. More info on this here.

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.