<div dir="ltr"><div><div><div><div><div><div><div>Dear all,<br><br></div>I'm having trouble merging Landsat scenes using the "merge" function in the raster package. No warnings are raised, but the merged scene looks as if 
overlap=FALSE - basically as though someone had taken a bunch of polaroids and placed them so they overlapped (if that does not make sense, please see attachment). <br>I'd like to get rid of
 the white "frames" around the individual scenes before further processing. Does anyone happen to know what the problem with my code might be, or has anyone had similar problems?<br><br>Thank you in advance for any hints you might be able to give!<br><br>My code looks as follows:<br><br></div><div># I load adjacent scenes as multi-layer objects:<br></div><div><div><br></div><div style="margin-left:40px"><span style="background-color:rgb(255,255,255)">scene1 <- stack(...) # multi-layer raster object<span style=""></span>; contains all 7 bands of the first scene<br>scene2 <- stack(...)<br>....<br>scene10<- stack(...)</span></div></div><br># Then I try merging these raster objects using a for-loop:<br><div style="margin-left:40px"><br>all_scenes <-as.list(print(c(scene1, scene2, ..., scene10)))<br><br>for(i in 1:length(all_scenes))<br></div><div style="margin-left:40px"><div style="margin-left:40px">{<br>  if (i == 1) {<br>    merged_scenes <- all_scenes[[i]][[1:7]]<br></div></div><div style="margin-left:40px"><div style="margin-left:40px"><div style="margin-left:40px">  } <br></div></div></div><div style="margin-left:40px"><div style="margin-left:40px">else if (i > 1) {<br>    merged_scenes <- merge(merged_scenes, all_scenes[[i]][[1:7]], tolerance = 0.05, overlap=TRUE)<br></div></div><div style="margin-left:40px"><div style="margin-left:40px"><div style="margin-left:40px">  }<br></div></div></div><div style="margin-left:40px"><div style="margin-left:40px">}<br><br></div></div><div style="margin-left:40px">writeRaster(merged_scenes, "filename", format = "GTiff", 
overwrite = TRUE)<br></div></div><div><br></div></div><br></div></div>Best wishes,<br></div>Henrike<br></div>