gee-community/eetasks

EE script run failed: Error: Can't convert a computed Geometry to GeoJSON. Use evaluate() instead.

lopezvoliver opened this issue · 1 comments

I encountered this error when trying to create a Export.image.toAsset task:

EE script run failed: Error: Can't convert a computed Geometry to GeoJSON. Use evaluate() instead.

In this context, I think it has to do with the region parameter (e.g., see source code here. This is the relevant piece of code in my export task:

var region = ee.FeatureCollection("FAO/GAUL/2015/level0")
.filter(ee.Filter.eq("ADM0_NAME","Saudi Arabia"))
.geometry().dissolve({maxError:500})

Export.image.toAsset({
      image: myEEimage,
      description:"myDescription",
      assetId:"myAssetId",
      crs:"EPSG:4326",
      crsTransform:[6/60,0,3/60,0,6/60,3/60],
      region:region
})

This script worked as is in the Code Editor.

After changing the code above to:

var region = ee.FeatureCollection("FAO/GAUL/2015/level0")
.filter(ee.Filter.eq("ADM0_NAME","Saudi Arabia"))
.geometry().dissolve({maxError:500})
.evaluate((r)=>{
    Export.image.toAsset({
      image: myEEimage,
      description:"myDescription",
      assetId:"myAssetId",
      crs:"EPSG:4326",
      crsTransform:[6/60,0,3/60,0,6/60,3/60],
      region:r
     })
}
)

then the script worked with EE Tasks: run GEE script and the task was submitted correctly.

ee.arguments.extractFromFunction might help with this, as well as to define some of the missing default values.