0

I ama trying to merge two RastertStack satellite data located just about over each other. I want to have them both in a single plot and I already set their extent to ESPG:3857.

I use the code:

MergedMap<-merge(StackedBands1,StackedBands3,tolerance=0.05, filename="MergedMap",overlap=FALSE,ext=NULL,overwrite=TRUE)

StackBands1 - 4 layers of different bands from Sentinel from location one StackBands2 - 4 Layers of different bands from Sentinel from location two

These two location are just beside each other and I want to have them on a single plot. After running the code they are turned into a rasterbrick and errors shows up while plotting them. There must be something wrong with my code so if someone can help. Thank you :)

MergedMap<-merge(StackedBands1,StackedBands3,tolerance=0.05,filename="MergedMap",overlap=FALSE,ext=NULL,overwrite=TRUE)
There were 50 or more warnings (use warnings() to see the first 50)

> plotRGB(MergedMap, r=4,g=3,b=2, axes = TRUE, stretch = "lin", main = "False Color Composite")
Error in if (x@file@nodatavalue < 0) { : 
  missing value where TRUE/FALSE needed

> warning(MergedMap)
Warning message:
brick(ncol=10980, nrow=10980, nl=4, xmn=0, xmx=10980, ymn=0, ymx=10980, crs='+proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs') 

I thought maybe there's no other way to stitch or merge two rasterstack layers and just have to do it on QGIS. But I want to find a way to have them. Do I have to edit the extent of these objects?

Phil
  • 7,287
  • 3
  • 36
  • 66
Johnny
  • 1

1 Answers1

0

I realized that the problem was that R Raster cannot read the Coordinates of sentinel data from the very beginning which messes up the merging of layers or stitching of different location.

Johnny
  • 1