I have exported GeoTIFF files from GEE and attempted to keep the pixel value in that raster layer. Once the file was imported into ArcGIS Pro the stats (min, max, mean and sd) were stretched between 0-255 instead of keeping the original pixel value from NDVI. Below is my code:
//get mean and std of NDVI
var mean = ee.Number(stats.get('NDVI_mean'));
var std = ee.Number(stats.get('NDVI_stdDev'));
//find regions in ndvi has value higher than mean +1SD
var maskImage = ndvi.updateMask(ndvi.gt(mean.add(std)));
//use the visualize function to set visualize parameters min and max equals to min and max in the raster
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')
};
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 maskImage = visualizeMinMaxNDVI(maskImage);
// Export a cloud-optimized GeoTIFF.
Export.image.toDrive({
image: maskImage,
description: '21072016UNDVItest',
scale: 10,
region: table,
fileFormat: 'GeoTIFF',
formatOptions: {
cloudOptimized: true
}
});
I'm very new to GEE, I think when I export my GeoTIFF layer the data was 8 bit (shown in ArcGIS Pro) which caused the color stretch?
No comments:
Post a Comment