2

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);

enter image description here

  • Did try to export the NDVI raster outside of google Drive? Also, in what type of file format the raster was exported ? – Ofir Apr 11 at 7:07
  • I did not try to export to another place of departure. The output format is .tif – wesleysc352 Apr 12 at 2:27
2

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

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 .

| improve this answer | |
  • Hello everyone, I apologize for the time lag. I tested some things and read the NDVI theory. Really, the correct thing is to use the image in SR (surface reflectance). As for geometry, I did correct it. I created a square in shp format in Qgis, then I uploaded it as a "table" and got the expected result. I thank everyone for their efforts, thank you very much. – wesleysc352 Apr 30 at 15:33

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.