0

I uploaded a map which I created of miombo woodland and added it to the Hansen gfc map layer with the idea being to export my map to my drive merged with gfc layers however I keep getting this error:

Error: Image.clipToBoundsAndScale, argument 'input': Invalid type. 
Expected type: Image<unknown bands>. Actual type: FeatureCollection. (Error code: 3)

This is my code:

var miombo_woodland = ee.FeatureCollection("users/mafuruse8097/miombo_woodland");
Map. addLayer(table);
var areaCover = treeCover.multiply(ee.Image.pixelArea())
                .divide(1000000).select([0],["table"]);

var areaLoss = loss.gt(0).multiply(ee.Image.pixelArea()).multiply(treeCover)
              .divide(1000000).select([0],["table"]);

var areaGain = gain.gt(0).multiply(ee.Image.pixelArea()).multiply(treeCover)
              .divide(1000000).select([0],["table"]);
var table = table.filter(ee.Filter.or());
            
// Sum the values of loss pixels.
var statsLoss = areaLoss.reduceRegions({
  reducer: ee.Reducer.sum(),
  collection: table,
  scale: 10
});

// Sum the values of gain pixels.
var statsGain = areaGain.reduceRegions({
  reducer: ee.Reducer.sum(),
  collection: table,
  scale: 10}); 
  

// Export the image, specifying the CRS, transform, and region.
Export.image.toDrive({
  image: table,
  description: 'miombo_woodland',
  scale: 10,
  region: table
});   

1 Answer 1

0

The error tell you the answer. You use Export.image.toDrive but pass it a FeatureCollection instead of an Image.

Try Export.table.toDrive instead:

Export.table.toDrive

Creates a batch task to export a FeatureCollection as a table to Drive.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.