Thursday, 8 September 2016

google earth engine - Export raster with its min max range from GEE 2


Following up with my previous question Export raster with its min max range from GEE. I have tried the code below: 1.adapted from this answer Using computed min/max image values to set min/max visualization parameters in GEE Use the .evaluate() function to convert server-side objects to client-side objects. Include the computed min and max values in an ee.Dictionary object and applied the .evaluate() function to it. A client-side dictionary object (dict) is made available within the scope of the anonymous function, where the min and max values can then be referenced and set as visualization parameters.


var minMax = ee.Dictionary({
minVal: stats.getNumber('NDVI_min'),

maxVal: stats.getNumber('NDVI_max')
});

print(minMax);

minMax.evaluate(function(dict) {
var vizParams = {
min: dict.minVal,
max: dict.maxVal,
palette: ['green']

};

Export.image.toDrive({
image: maskImage.visualize(vizParams),
description: '21072016UNDVI',
scale: 10,
region: table,
fileFormat: 'GeoTIFF',
formatOptions: {
cloudOptimized: true

}
});
});

It is not working. Then I tried this code: 2.adapted from this answer Any way to have variable min and max in one visualization parameter?.


var minMax = ee.Dictionary({
minVal: stats.getNumber('NDVI_min'),
maxVal: stats.getNumber('NDVI_max')
});


print(minMax);

minMax.evaluate(function(val) {
var vizParams = {
min: val.minVal,
max: val.maxVal,
palette: ['green']
};
// Export a cloud-optimized GeoTIFF.
Export.image.toDrive({

image: maskImage.visualize(vizParams),
description: '21072016UNDVI',
scale: 10,
region: table,
fileFormat: 'GeoTIFF',
formatOptions: {
cloudOptimized: true
}
});
});


It is still not working.... Does it have something to do with the Nodata or null data?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...