I would like to convert a raster image into vector. My image is referenced to a specific zone (vect). I'm working with Hansen dataset and in particularly the layer 'lossyear'. Raster image is from a different polygon in a specific year (for example 2007) and I obtain it by the function ReduceResolution. The value of different pixel that constitute the image are float number. The code is:

var loss_2007_vt = loss_2007_filtered_res.reduceToVectors({ reducer: ee.Reducer.mean(), geometry: vect, crs: collection.projection(), scale:500, geometryType:'polygon', });

I received this error message: "FeatureCollection (Error) Image.reduceToVectors: Need 1+1 bands for , image has 1".


Try not specifying the reducer. I think it's looking for additional bands to reduce (i.e. get the mean for a homogeneous region and set it as a property of the output feature) and not finding any.

  • 1
    If I don't specify the option reducer of the function reduceToVectors I obtain this error message "FeatureCollection (Error) Image.reduceToVectors: First band ('lossyear') of image must be integral". – matt85 Jul 29 '18 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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