I want to split multiple raster into 4 equal segments, I found the splitRaster() function from the SpaDES package, which seems to do exactly this. However, it results in an error while executing.

This is my code:


nx <- 2
ny <- 2

image <- raster('F:/IrSo/Thesis_IrSo/DATA/phenologymetrics/2018/2018_EVI_Sentinel/tiff/s2_20171202_evi.tif')

split_image <- splitRaster(images, nx, ny, path="F:/IrSo/Thesis_IrSo/DATA/phenologymetrics/2018/2018_EVI_Sentinel/tiff/1")

And this is my error message which appear exactly after I run the splitRaster line of code:

Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘splitRaster’ for signature ‘"list"’

Any ideas?

closed as unclear what you're asking by Spacedman, whyzar, Vince, Jochen Schwarze, LaughU Feb 12 at 11:22

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    What's images? You read in image but then run on images, and we have no idea what that is. Maybe you mistyped it. Also, we don't have your data file so we can't run your example. Can you make it fail on a data set that we can all get? – Spacedman Feb 11 at 16:05
  • 1
    Also, how would you split a 131x131 raster into four equal segments? Do you want to subdivide cells? Or is your data always an even number of pixels in both directions? Or do you want as near as possible equal segments? And do you only want a 2x2 array of segments? Because a 4x1 array is also "four equal tiles". – Spacedman Feb 11 at 17:01

Browse other questions tagged or ask your own question.