Google Earth Engine – Converting Raster to Vector in Google Earth Engine

google-earth-enginevectorization

By running the code, one obtains:

FeatureCollection (Error) Image.reduceToVectors: First band ('x') of image must be integral.

I donĀ“t understand this error. My goal is to convert the pixel values into vector data, e.g. Points.

var coorsfeat = mean.reduceToVectors({
reducer : null,
geometry : geometry,
crs :mean.projection().getInfo().crs,
crsTransform :mean.projection().getInfo().transform,
geometryType : 'centroid',
labelProperty : 'Precip'
})

Link to GEE

Best Answer

The error regarding the Integral was fixable by converting the input Data from float to Int. I recommend a multiplication to evade Data precision loss.

Fix: var mean= ImCol.filterBounds(aoi).filterDate('2017-01-01','2017-12-31').mean() .multiply(10000).toInt()

Unfortunately, this retrieves 0 Features.

Changing the Following Arguments to scale did the Trick :

crs :mean.projection().getInfo().crs, crsTransform :mean.projection().getInfo().transform

Unfortunately, this doesn't obtain one Feature per Pixel. Gonna open a new Thread for this one, as it seems to be a different problem then initially described in this thread

Related Question