diff --git a/man/not.na.Rd b/man/not.na.Rd
index 0680f0acc..867d7e77f 100644
--- a/man/not.na.Rd
+++ b/man/not.na.Rd
@@ -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}}}
}
diff --git a/src/write_ogr.cpp b/src/write_ogr.cpp
index 80d261ef7..1488f4686 100644
--- a/src/write_ogr.cpp
+++ b/src/write_ogr.cpp
@@ -16,17 +16,16 @@
// along with spat. If not, see .
#include "spatVector.h"
+#include
#include "string_utils.h"
#include
-#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 options) {
GDALDataset *poDS = NULL;
@@ -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 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;
@@ -394,7 +398,6 @@ GDALDataset* SpatVector::GDAL_ds() {
}
-#include
bool SpatDataFrame::write_dbf(std::string filename, bool overwrite, SpatOptions &opt) {
// filename is here "raster.tif"