-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Differences between raster::merge and terra::merge & NA handling #160
Comments
Thank you for reporting this bug.
This has already been fixed in the development version available here (currently version 1.1.2)
terra now behaves like raster --- the idea is the earlier layers are "more important", but I understand why you think the opposite could be more logical. I will keep it as it is now (like raster). The documentation already states that "If objects overlap, the values get priority in the same order as the arguments" .
Indeed a good work-around in the CRAN version |
Thanks for providing the workaround and addressing the comments! I ended up doing my task via data frames, after all, but good to know that the merge/mosaic workflows would be as applicable. |
I have large number of raster files (with large sizes). The merge function in terra fails when using the code below (with this error: "Error in rc@ptr$merge(opt) : std::bad_alloc"), but it works with the same function in raster package (although very slow).
|
@HassanMasoomi, have you tried using SpatRasterCollection ls <- list(r1, r2)
ras_coll <- sprc(ls)
m <- merge(ras_coll) Or |
@kadyb, yes, I did try SpatRasterCollection and it had the same issue. But, haven't tried |
Hello,
I am composing global rasters from small parts using ideally merge. I am running terra 1.0.10.
I've noticed some difference between raster and terra: in raster::merge, the parameter overlap controls how NA values should be handled and this seems not to be available in terra::merge. See below for a reprex adapted from terra manual.
There are two issues in total:
Thanks for superb development with terra; it's incredibly fast and versatile!
The text was updated successfully, but these errors were encountered: