Skip to content

Commit

Permalink
fixes #336
Browse files Browse the repository at this point in the history
  • Loading branch information
rhijmans committed Jul 8, 2024
1 parent a887793 commit 07c792c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions R/coerce.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ setAs("SpatRaster", "Raster",
if ((length(usid) == 1) & (b$source[1] != "")) {
if ((nl == nrow(b)) && (b$bands[1] == 1) && (all(diff(b$bands) == 1))) {
r <- raster::brick(b$source[1])
if (nlayers(r) != nl) {
r <- r[[b$bands]]
}
} else {
r <- raster::stack(b$source[1], bands=b$bands)
}
Expand Down

0 comments on commit 07c792c

Please sign in to comment.