Skip to content

Commit

Permalink
n
Browse files Browse the repository at this point in the history
  • Loading branch information
rhijmans committed Dec 20, 2024
1 parent 3459e47 commit d97e8dd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion man/not.na.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Shortcut method to avoid the two-step \code{!is.na(x)}

\arguments{
\item{x}{SpatRaster}
\item{falseNA}{logical. If \code{TRUE}, the output values are \code{TRUE} for cells that are not \{NA}, and \code{NA} for other cells. Otherwise, the output values are \code{TRUE} and \code{FALSE}}
\item{falseNA}{logical. If \code{TRUE}, the output cell values are either \code{TRUE}, for cells that are not \code{NA} in \code{x}, or \code{NA} for the cells that are \code{NA} in \code{x}. Otherwise, the output values are either \code{TRUE} or \code{FALSE}}
\item{filename}{character. Output filename}
\item{...}{additional arguments for writing files as in \code{\link{writeRaster}}}
}
Expand Down
13 changes: 8 additions & 5 deletions src/write_ogr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@
// along with spat. If not, see <http://www.gnu.org/licenses/>.

#include "spatVector.h"
#include <fstream>
#include "string_utils.h"
#include <stdexcept>
#include "NA.h"

#include "vecmath.h"

#ifdef useGDAL

#include "file_utils.h"
#include "ogrsf_frmts.h"


GDALDataset* SpatVector::write_ogr(std::string filename, std::string lyrname, std::string driver, bool append, bool overwrite, std::vector<std::string> options) {

GDALDataset *poDS = NULL;
Expand Down Expand Up @@ -175,7 +174,12 @@ GDALDataset* SpatVector::write_ogr(std::string filename, std::string lyrname, st
if (tps[i] == "double") {
otype = OFTReal;
} else if (tps[i] == "long") {
otype = OFTInteger64;
std::vector<long> rge = vrange(df.getI(i), true);
if ((rge[0] > -32768) & (rge[1] < 32767)) {
otype = OFTInteger;
} else {
otype = OFTInteger64;
}
} else if (tps[i] == "bool") {
otype = OFTInteger;
eSubType = OFSTBoolean;
Expand Down Expand Up @@ -394,7 +398,6 @@ GDALDataset* SpatVector::GDAL_ds() {
}


#include <fstream>

bool SpatDataFrame::write_dbf(std::string filename, bool overwrite, SpatOptions &opt) {
// filename is here "raster.tif"
Expand Down

0 comments on commit d97e8dd

Please sign in to comment.