I tried to export the NDVI obtained from the Landsat 8 Surface Reflectance Collection in Google Earth Engine and I keep on getting black lines in my final export. Everything looks fine when displaying it on the map online, it's just the export to google drive that has the problem.
Here is the code I'm using
var region = ee.FeatureCollection(
'ft:1A9vRY9l-eBNBFBwAV_mLAEeCIPYS2T14vsKhiEQc');
var crop = region.geometry();
function mask_image(image){
return image.updateMask(image.select('pixel_qa').bitwiseAnd(ee.Image.constant(2)).eq(2));
}
function ndvi(image){
return image.addBands(image.normalizedDifference(['B5','B4']).rename('NDVI'));
}
var start = ee.Date('2013-01-01');
var end = ee.Date('2017-12-31');
var image = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
.filterDate(start,end)
.filterBounds(crop)
.map(mask_image)
.map(ndvi);
var to_export = image.mean().select(['NDVI']);
Export.image.toDrive({
image: to_export,
description: 'NDVI-test',
folder:'Landsat8-NDVI',
scale: 30,
region: crop,
maxPixels:1e10,
crs: 'EPSG: 32718'
});
Map.centerObject(image,8);
Map.addLayer(to_export.clipToCollection(region));
This is how it looks like when opening the export image in a GIS software.
Best Answer
This problem is caused through your reduction on the line with:
Compositions and reductions have no projection and are just reported as being WGS84.
This script exports the map without the vertical lines (https://code.earthengine.google.com/0de29cd6954bada783ef0bacbb5b1ba6):
It prints the crs and scale of an image in the image-collection called 'image' and does the same from the image called 'to_export' which is created by taking the mean of the images in 'image'.
You can see that initially, the crs is EPSG:32619 with a scale of 30 meters. After the mean-reduction, the crs of 'to_export' is EPSG:4326 with a scale of 111319.49079327357 meters. So we need to add one more line to your code, before proceeding to the export, i.e. 'to_export.reproject(original_proj);'.
Now the projection is correct again and your export doesn't contain the vertical lines.