1

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....

  • the function expects a single image as input. You can only map over an image collection. Just try var newImge = visualizeMinMaxNDVI(maskImage); – Kuik Jan 31 at 4:52
  • Hi @Kuik thanks for your comment. I have tried the code and somehow when I import the Geotiff in ArcGIS the stats (min, max, mean and std) were stretched with in 0-255 range instead of the original NDVI pixel value..I have asked a new questiona and posted my code (gis.stackexchange.com/questions/350094/…). – Rose Chai Feb 10 at 2:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.