Skip to content

Commit

Permalink
fixes #1254
Browse files Browse the repository at this point in the history
  • Loading branch information
rhijmans committed Aug 23, 2023
1 parent 2318105 commit 2347d0c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: terra
Type: Package
Title: Spatial Data Analysis
Version: 1.7-41
Date: 2023-07-04
Version: 1.7-42
Date: 2023-08-23
Depends: R (>= 3.5.0)
Suggests: parallel, tinytest, ncdf4, sf (>= 0.9-8), deldir, XML, leaflet, htmlwidgets
LinkingTo: Rcpp
Expand Down
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# version 1.7-41
# version 1.7-43

## bug fixes

`plot<SpatVector>` used the wrong main label in some cases [#1210](https://github.com/rspatial/terra/issues/1210) by Márcia Barbosa
`plotRGB` failed with an "ext=" argument [#1228](https://github.com/rspatial/terra/issues/1228) by Dave Edge
`rast<array>` failed badly when the array had less than three dimensions. [#1254](https://github.com/rspatial/terra/issues/1254) by andreimirt.


## enhancements
Expand Down
3 changes: 3 additions & 0 deletions R/rast.R
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,9 @@ setMethod("rast", signature(x="SpatRasterDataset"),
setMethod("rast", signature(x="array"),
function(x, crs="", extent=NULL) {
dims <- dim(x)
if (length(dims) < 3) {
error("rast,array", "cannot handle an array with less than 3 dimensions")
}
if (length(dims) > 3) {
if (length(dims) == 4) {
if (dims[4] == 1) {
Expand Down
1 change: 1 addition & 0 deletions src/spatRaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ bool SpatRaster::hasValues() {
SpatRaster::SpatRaster(std::vector<unsigned> rcl, std::vector<double> ext, std::string crs) {

SpatRasterSource s;
rcl.resize(3, 1);
s.nrow=rcl[0];
s.ncol=rcl[1];
s.extent.xmin = ext[0];
Expand Down

0 comments on commit 2347d0c

Please sign in to comment.