I try to export a raster with NDVI values from Google Earth Engine. Although the export works fine, the original NDVI values (-1 to +1) are translated into 8bit values between 0 and 255 in the resulting image. How can I export the NDVI results conserving the original values?
Below the code, I´m using. If you import the "Sentinel-2 MSI: MultiSpectral Instrument, Level-2A" image collection and set the variable name to sent2_collection, you can run the code.
function add_ndvi_band(image){ var ndvi = image.normalizedDifference(["B8","B4"]); return image.addBands(ndvi); } var time_filter = sent2_collection.filterDate("2019-01-01", "2019-12-31"); var time_filter_ndvi = time_filter.map(add_ndvi_band); Map.addLayer(time_filter.median(), {bands:["B4","B3","B2"], min:0, max:3000}, "Cuautla - true color"); Map.addLayer(time_filter_ndvi.median(), {bands:"nd", min: -1, max: 1}, "Cuautla-NDVI"); var exportar_mapa = time_filter_ndvi.median().visualize({bands: ['nd', 'nd', 'nd'],max: 1.0}); Export.image.toDrive({image: exportar_mapa, description: 'ndvi', scale: 10});