this is a question folllowing up with my previous question Export raster with its min max range from GEE and Export raster with its min max range from GEE 2. I need to export the GeoTIFF with pixels in the raster layer keep their index value so I can use it in ArcGIS. Below is the code I tried from @Kuik's answer and his link:
var visualizeMinMaxNDVI = function(maskImage) {
var minMax = maskImage.reduceRegion({
reducer: ee.Reducer.minMax(),
bestEffort: true,
});
var visParams = {
min: minMax.getNumber('NDVI_min'),
max: minMax.getNumber('NDVI_max'),
palette:'green'
};
return maskImage.visualize(visParams)
.set({min: minMax.getNumber('NDVI_min'), max: minMax.getNumber('NDVI_max')});
};
// set visualization parameters based on min and max value
var NDVIvis = maskImage.map(function(maskImage){
return visualizeMinMaxNDVI(maskImage);
});
print(NDVIvis);
// Export a cloud-optimized GeoTIFF.
Export.image.toDrive({
image: maskImage,
description: '21072016UNDVI',
scale: 10,
region: table,
fileFormat: 'GeoTIFF',
formatOptions: {
cloudOptimized: true
}
});
I got error maskImage.map is not a function.
Also, how can I put visParams
into Export.image.toDrive
now (since visParams
is a parameter in the function).
If you want to see my previous code please check the links at the start. Sorry for codes all over the place....
var newImge = visualizeMinMaxNDVI(maskImage);