diff --git a/R/divide.R b/R/divide.R index 11b72bfcd..2329d7368 100644 --- a/R/divide.R +++ b/R/divide.R @@ -197,6 +197,8 @@ strip_polygon <- function(x, vertical, horizontal) { divide_polygon <- function(x, n, w, alpha, ...) { + xcrs <- crs(x) + crs(x) <- "+proj=utm +zone=1" s <- terra::spatSample(x, max(n*4, 1000, log(n) * 100), "regular") xy <- terra::crds(s) if (!is.null(w)) { @@ -231,11 +233,9 @@ setMethod("divide", signature(x="SpatVector"), n <- round(n) stopifnot(n > 0) if (n == 1) return(deepcopy(x)) - xcrs <- crs(x) - crs(x) <- "+proj=utm +zone=1" out <- lapply(1:nrow(x), function(i) divide_polygon(x[i], n, w, alpha, ...)) } - return(do.call(rbind, out)) + return() } ) diff --git a/src/write_ogr.cpp b/src/write_ogr.cpp index 5e53b5a2c..f4b89b45e 100644 --- a/src/write_ogr.cpp +++ b/src/write_ogr.cpp @@ -175,7 +175,7 @@ GDALDataset* SpatVector::write_ogr(std::string filename, std::string lyrname, st otype = OFTReal; } else if (tps[i] == "long") { std::vector rge = vrange(df.getI(i), true); - if ((rge[0] >= -32768) && (rge[1] <= 32767)) { + if ((rge[0] >= -2147483648) && (rge[1] <= 2147483648)) { otype = OFTInteger; } else { otype = OFTInteger64;