[RS-ecology] Problem with merging raster objects

Henrike StB henrikestb at gmail.com
Wed Mar 23 15:26:32 CET 2016


Dear all,

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).
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?

Thank you in advance for any hints you might be able to give!

My code looks as follows:

# I load adjacent scenes as multi-layer objects:

scene1 <- stack(...) # multi-layer raster object; contains all 7 bands of
the first scene
scene2 <- stack(...)
....
scene10<- stack(...)

# Then I try merging these raster objects using a for-loop:

all_scenes <-as.list(print(c(scene1, scene2, ..., scene10)))

for(i in 1:length(all_scenes))
{
  if (i == 1) {
    merged_scenes <- all_scenes[[i]][[1:7]]
  }
else if (i > 1) {
    merged_scenes <- merge(merged_scenes, all_scenes[[i]][[1:7]], tolerance
= 0.05, overlap=TRUE)
  }
}

writeRaster(merged_scenes, "filename", format = "GTiff", overwrite = TRUE)


Best wishes,
Henrike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.uni-wuerzburg.de/pipermail/rs-ecology/attachments/20160323/a8347751/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Failed scene merge.PNG
Type: image/png
Size: 56926 bytes
Desc: not available
URL: <http://lists.uni-wuerzburg.de/pipermail/rs-ecology/attachments/20160323/a8347751/attachment-0001.png>


More information about the RS-ecology mailing list