[R-sig-Geo] Mosaic Rasters

Brian Buma brian.buma at uas.alaska.edu
Sat Sep 20 02:37:30 CEST 2014


I apologize I don't have reproduce-able code, but I don't entirely
understand the error.

I have a list of rasters which are all subsets of the same watershed,
created from a lidar dataset.  Because of memory limitations, I had to
process in chunks, and now I'm mosaicing them back together.  The code is a
quick for loop, and it loads one, mosaics it to the previous one, and then
moves onto the next one.

However, sometimes I get an error of "Error in v[cells, i] <-
getValues(x[[i]]) :
  number of items to replace is not a multiple of replacement length"

I understand what that means in terms of vectors and things, but I don't
get it for the raster.  I thought perhaps it was because each chunk wasn't
exactly the same size in terms of rows and columns (all are the same
resolution).  But if I skip the chunks that kick out that error, then go
back and mosaic them at the end, it works.  So with careful ordering of my
input chunks, I can get the whole mosaic out.  Why would that be?
 Shouldn't mosaic be able to handle all sorts of various extents, assuming
the projection, resolution, and origin are the same?  Maybe that's not the
problem?

Again, apologize for not having more info to go on, but I don't really know
what is going wrong so I can't recreate the error in a code snippet.

-brian

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list