Skip to content

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

@lopezvoliver

Description

@lopezvoliver

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions