My goal is to perfectly obtain one vector point per raster cell, located at the Center of the RasterCell
Running .reduceToVectors()
with the scale
argument retrieves vector points, but none fit the raster.
var coorsfeat = mean.reduceToVectors({
reducer : null,
geometry : geometry,
scale:6800,
//crs :mean.projection().getInfo().crs,
//crsTransform :mean.projection().getInfo().transform,
geometryType : 'centroid',
labelProperty : 'Precip',
eightConnected: false
})
Running with:
scale: mean.projection().nominalScale().getInfo()
= 111319.49079327357
retrieves no features
Running with :
crs :mean.projection().getInfo().crs,
crsTransform :mean.projection().getInfo().transform,
retrieves no Features
Is there a more elegant way of achieving the goal?
Best Answer
Loosely based on this answer, you can make a feature collection consisting of points at the center of each pixel.
For your purpose, you can do that as follows:
link script