<html><head></head><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:16px"><div id="yui_3_16_0_ym18_1_1458741902332_5609"><span id="yui_3_16_0_ym18_1_1458741902332_5611">Hello,</span></div><div dir="ltr" id="yui_3_16_0_ym18_1_1458741902332_5612"><span id="yui_3_16_0_ym18_1_1458741902332_5611">try to create a mask and clip each image before merging (see the pic attached)</span></div><div id="yui_3_16_0_ym18_1_1458741902332_6272" dir="ltr">Best wishes,</div><div dir="ltr"><br></div><div id="yui_3_16_0_ym18_1_1458741902332_6300" dir="ltr">Fils Salomon <br></div><div id="yui_3_16_0_ym18_1_1458741902332_5647" class="signature"><div id="yui_3_16_0_ym18_1_1458741902332_5731"><font id="yui_3_16_0_ym18_1_1458741902332_5821" style="font-weight:bold;" size="3"><span id="yui_3_16_0_ym18_1_1458741902332_5820" class="yui_3_2_0_2_133070747885064" style="font-family:times new roman, new york, times, serif;">------------------------------------------------------------------------------------------------------------------------------------<br></span></font></div><div id="yui_3_16_0_ym18_1_1458741902332_5646" style="font-family:'times new roman', 'new york', times, serif;"><font id="yui_3_16_0_ym18_1_1458741902332_5894" style="font-weight:bold;" size="3">Salomon Cesar </font><font id="yui_3_16_0_ym18_1_1458741902332_5819" style="font-weight:bold;" size="3">NGUEMHE FILS </font><br><font id="yui_3_16_0_ym18_1_1458741902332_5649" size="3">Institute of Geological and Mining Research (<b id="yui_3_16_0_ym18_1_1458741902332_5648">IRGM</b>)<br><b id="yui_3_16_0_ym18_1_1458741902332_5890">Res<font size="3">e<font size="3">arch Officer<br></font></font>Image Processing Laboratory</b> <font size="2"><span style="font-style:italic;font-weight:bold;"><span style="background-color:rgb(255, 255, 255);">(LTI)</span><br></span></font></font><font id="yui_3_16_0_ym18_1_1458741902332_6007" size="3"><b id="yui_3_16_0_ym18_1_1458741902332_6006">National Data Centre (NDC) Cameroon</b></font><font size="3"><br>4110 Nlongkak_Yaounde, Cameroon. <br>GSM (Cameroon): +237 672 77 82 37; +237 690 18 40 84<span class="yui_3_2_0_2_133098962174076" style="font-style:italic;font-weight:bold;background-color:rgb(137, 138, 73);"></span></font></div></div> <div class="qtdSeparateBR"><br><br></div><div style="display: block;" class="yahoo_quoted"> <div style="font-family: HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div dir="ltr"><font face="Arial" size="2"> Le Mercredi 23 mars 2016 16h06, Henrike StB <henrikestb@gmail.com> a écrit :<br></font></div>  <br><br> <div class="y_msg_container"><div id="yiv2316946740"><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></div><br>_______________________________________________<br>RS-ecology mailing list<br><a ymailto="mailto:RS-ecology@lists.uni-wuerzburg.de" href="mailto:RS-ecology@lists.uni-wuerzburg.de">RS-ecology@lists.uni-wuerzburg.de</a><br><a href="https://lists.uni-wuerzburg.de/mailman/listinfo/rs-ecology" target="_blank">https://lists.uni-wuerzburg.de/mailman/listinfo/rs-ecology</a><br><br><br></div>  </div> </div>  </div></div></body></html>