I generated a Lansat 5 image NDVI in a rectangle of interest in Google Earth Engine.
After that, I tried to export the image to my Google Drive, but the final result does not load the usual values of an NDVI (-1 to +1), as is usually done in a GIS program (QGIS, ArcGIS, etc.). The DN has a single value (attached image).
How could I solve this?
My code is:
var imgL5 = ee.Image('LANDSAT/LT05/C01/T2_TOA/LT05_226074_19850719');
var poly = ee.Geometry.Polygon([[
[-56.298454803020135,-20.398292995561647],
[-56.298454803020135,-19.8799857811524],
[-57.037285369426385,-19.8799857811524],
[-57.037285369426385,-20.398292995561647]
]])
var cortado = imgL5.clip(poly);
//Calc NDVI
var nir = cortado.select('B5');
var red = cortado.select('B4');
var NDVI = nir.subtract(red).divide(nir.add(red));
Map.addLayer(NDVI);
// Export the image, specifying scale and region.
Export.image.toDrive({
image: NDVI.float(),
description: 'NDVI_9',
scale: 30,
region: geometry,
folder: 'GEE',
});
Map.setCenter(-56.67318953949383,-20.121019484901392, 10);
Best Answer
I ran your code. I only updated- "region: poly" (and not- "region: geometry") and it worked fine with Qgis. Maybe the region you defined in the export code was the problem ?![enter image description here](https://i.stack.imgur.com/3RGNM.png)
BTW if you want your NDVI values to be between -1 to 1 you can use landsat5 surface reflectance: https://developers.google.com/earth-engine/datasets/catalog/LANDSAT_LT05_C01_T1_SR . In your code you used top of atmosphere data and that's why there is values smaller then -1 .