0

I made a raster layer on google earth engine that only contain pixels have value higher than SAVI mean+1SD. I exported the raster layer as GeoTIFF and specified the raster as green colour. When I checked it in ArcGIS, the area wasn't into the green raster region showed black and the black area was larger than my polygon, which made it impossible to overlap this raster with the satellite image beneath. Is there anyway to change the black colour into no colour? Here is my code:

var Blueskin =ee.Image('COPERNICUS/S2/20160721T223713_20160722T000334_T59GMK');
Map.centerObject(Blueskin, 10);

var Mask = ee.FeatureCollection(table);
Mask = Mask.geometry();
Map.centerObject(Mask);
var Blueskin = Blueskin.clip(Mask);
Map.addLayer(Blueskin,Color, 'False Color');
var Red=Blueskin.select('B4');
var NIR=Blueskin.select('B8');
var savi = (NIR.subtract(Red)).divide(NIR.add(Red).add(0.8)).multiply(1.8).rename('SAVI');

var mean = ee.Number(stats.get('SAVI_mean'))
var std = ee.Number(stats.get('SAVI_stdDev'))
var maskImage = savi.updateMask(savi.gt(mean.add(std)));
Map.addLayer(maskImage, {palette: 'green'}, 'mask image');

// Keep only 'B' bands
Blueskin = Blueskin.select('B.+')
// Export a cloud-optimized GeoTIFF.
Export.image.toDrive({
  image: Blueskin,
  description: '210716FC',
  scale: 10,
  region: table,
  fileFormat: 'GeoTIFF',
  formatOptions: {
    cloudOptimized: true
  }
});
print(maskImage);

var visualization_params =  {palette:'green'};
// Export a cloud-optimized GeoTIFF.
Export.image.toDrive({
  image: maskImage.visualize(visualization_params),
  description: '210716USAVI8',
  scale: 10,
  region: table,
  fileFormat: 'GeoTIFF',
  formatOptions: {
    cloudOptimized: true
  }
});

When I checked the image property of "maskImage" -the raster layer on google earth engine, it showed it only has one band called 'SAVI'. But when I imported it into ArcGIS it became three bands (RGB) with red and blue has value "0", which seems like there is only one band (the green) has same value (according to Symbology). Also, in symbology if I change the stretch into only one band the entire layer is just gone black.

  • I noticed in ArcGIS the reclassify layer is XML Document. Does the problem I'm having now have something to do with the file format? If so is there anyway to solve it? – Rose Chai Jan 17 at 1:56
  • What is the point of defining visualize parameters for the export? It's just for visualizing in Earth Engine. And when you apply the stretch in Arcgis make sure you define the correct parameters for visualizing, e.g. stretch with 1 std or the correct min and max value. – Jobbo90 Jan 17 at 8:00
  • Hi @Jobbo90 thanks for your comment I managed to solve the problem by ticking the "display background value" box in mask in symbology in ArcGIS. However, I did notice that the value of all pixels in my raster indice layer is universally 0, which makes min, max, sd, mean all 0. Is there anyway to change the value of pixels in the raster layer to 1 so that those pixels can be differentiated from the non-raster layer? – Rose Chai Jan 22 at 2:06

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.