I found this issue after exporting a mean composite of a custom NDVI band in the Landsat 8 Surface Reflectance collection to Google Drive only to get a lot of black lines on one side of the image. This pointed me out that it could be a projection related problem although I am not sure if this is the real reason of the black lines
A point inside the ROI I am using is at (-13.38427568438877, -71.905517578125) which is clearly located in the southern hemisphere and therefore, using the UTM crs, is located in the UTM 18S zone. The problem arises when requesting the projection info by using the .projection()
method over one of the images in the collection, the output in the console shows crs: EPSG:32618
, which is the spatial reference for UTM 18N zone, when it should show EPSG:32718
which is the correct one.
The code I am using to get this output goes as follows:
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);
print(image);
// This is where I begin the debug by narrowing down dates and
// checking the images projections one by one.
var test = image.filterDate('2016-03-01','2016-03-31');
print(test);
print(ee.Image('LANDSAT/LC08/C01/T1_SR/LC08_004069_20160315').projection());
var test2 = test.mean()
// This is the export that gives me black lines in the image
Export.image.toDrive({
image: test2.select(['NDVI']).clipToCollection(region),
description: 'NDVI-test',
folder:'Landsat8-NDVI',
scale: 30,
region: crop,
maxPixels:1e10,
crs: 'EPSG: 32718'
})
Map.centerObject(image,8);
Map.addLayer(ee.Image('LANDSAT/LC08/C01/T1_SR/LC08_004069_20160315'));
[30,0,709485,0,-30,-1323585]
and the footprint coordinates of it are all in lat/lon, I'm not sure if that helps at all..projection()
method.