Search code examples
javascriptapigoogle-earthgoogle-earth-plugingoogle-earth-engine

Update metadata of an asset in Google Earth Engine API with Javascript


I want to update the metadata properties for an asset, whether it's an Image or Table/Featured Collection.

I've followed the documentation but it's not updating or giving me any errors... https://developers.google.com/earth-engine/apidocs/ee-featurecollection-set

let asset = await ee.FeatureCollection(assetId);
let response = await asset.set('property_name', 'property_value')

Any ideas how to do this with the Javascript NPM library? Thank you.


Solution

  • It's not in the documentation but in the source code I found the following and it works:

    ee.data.setAssetProperties(assetId, {
      'property_name': "property_value"
    }, (response) => {
      console.log(response)
    })