Skip to content

Commit

Permalink
s
Browse files Browse the repository at this point in the history
  • Loading branch information
rhijmans committed Jan 3, 2022
1 parent f75ba5b commit 805e5e8
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: raster
Type: Package
Title: Geographic Data Analysis and Modeling
Version: 3.5-10
Date: 2021-12-10
Version: 3.5-12
Date: 2022-01-02
Imports: Rcpp, methods, terra (>= 1.4-11)
LinkingTo: Rcpp
Depends: sp (>= 1.4-5), R (>= 3.5.0)
Expand Down
19 changes: 18 additions & 1 deletion R/stackQuick.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,20 @@
r@data@names <- ln[i]
r@data@min <- mn[i]
r@data@max <- mx[i]
if (b@data@isfactor[i]) {
r@data@isfactor <- b@data@isfactor[i]
r@data@attributes <- b@data@attributes[[i]]
}
r
})
})
} else {
s@layers <- sapply(bands, function(i){
r@data@values <- b@data@values[,i]
r@data@names <- ln[i]
if (b@data@isfactor[i]) {
r@data@isfactor <- TRUE
r@data@attributes <- b@data@attributes[i]
}
r
})
}
Expand All @@ -109,15 +117,24 @@
r@data@names <- ln[i]
r@data@min <- mn[i]
r@data@max <- mx[i]
if (b@data@isfactor[i]) {
r@data@isfactor <- b@data@isfactor[i]
r@data@attributes <- b@data@attributes[i]
}
r
})
} else {
s@layers <- sapply(bands, function(i){
r@data@band <- i
r@data@names <- ln[i]
if (b@data@isfactor[i]) {
r@data@isfactor <- b@data@isfactor[i]
r@data@attributes <- b@data@attributes[i]
}
r
})
}
}
s
}

2 changes: 1 addition & 1 deletion man/direction.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The direction (azimuth) to or from the nearest cell that is not \code{NA}. The d
\item{filename}{Character. Output filename (optional)}
\item{degrees}{Logical. If \code{FALSE} (the default) the unit of direction is radians.}
\item{from}{Logical. Default is \code{FALSE}. If \code{TRUE}, the direction from (instead of to) the nearest cell that is not \code{NA} is returned}
\item{doEdge}{Logical. If \code{TRUE}, the \code{\link{boundaries}} function is called first. This may be efficient in cases where you compute the distance to large blobs. Calling \code{boundaries} determines the edge cells that matter for distance computation}
\item{doEdge}{Logical. If \code{TRUE}, the \code{\link{boundaries}} function is called first. This may be efficient in cases where you compute the distance to large blobs. Calling \code{boundaries} determines the edge cells that matter for direction computation}
\item{...}{Additional arguments as for \code{\link{writeRaster}}}
}

Expand Down
11 changes: 11 additions & 0 deletions src/spat.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ using namespace std;

class SpExtent {
public:
virtual ~SpExtent(){}

double xmin, xmax, ymin, ymax;
SpExtent() {xmin = -180; xmax = 180; ymin = -90; ymax = 90;}
SpExtent(double _xmin, double _xmax, double _ymin, double _ymax) {xmin = _xmin; xmax = _xmax; ymin = _ymin; ymax = _ymax;}
Expand Down Expand Up @@ -35,6 +37,8 @@ class SpExtent {

class SpPolyPart {
public:
virtual ~SpPolyPart(){}

std::vector<double> x, y;
std::vector< std::vector<double>> xHole, yHole;

Expand All @@ -61,6 +65,8 @@ class SpPolyPart {

class SpPoly {
public:
virtual ~SpPoly(){}

std::vector<SpPolyPart> parts;
SpExtent extent;

Expand All @@ -84,6 +90,7 @@ class SpPoly {

class SpPolygons {
public:
virtual ~SpPolygons(){}
std::vector<SpPoly> polys;
SpExtent extent;
std::string crs;
Expand Down Expand Up @@ -127,6 +134,7 @@ class SpPolygons {

class RasterSource {
public:
virtual ~RasterSource(){}
std::vector<bool> memory;
std::vector<string> filename;
std::vector<string> driver;
Expand All @@ -139,6 +147,7 @@ class RasterSource {

class BlockSize {
public:
virtual ~BlockSize(){}
std::vector<unsigned> row;
std::vector<unsigned> nrows;
unsigned n;
Expand All @@ -162,6 +171,8 @@ class SpRaster {
BlockSize getBlockSize();

public:
virtual ~SpRaster(){}

//double NA = std::numeric_limits<double>::quiet_NaN();
RasterSource source;

Expand Down

0 comments on commit 805e5e8

Please sign in to comment.