Skip to content

Commit 3854cda

Browse files
committed
for # 1996
1 parent c5e280a commit 3854cda

File tree

6 files changed

+36
-2
lines changed

6 files changed

+36
-2
lines changed

NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ S3method(str, SpatRaster)
2121
S3method(str, SpatExtent)
2222
S3method(str, SpatGraticule)
2323

24-
export(add_abline, add_box, add_legend, add_grid, add_mtext, ar_info, clearVSIcache, combineLevels, focalMat, extractAlong, gdal, getGDALconfig, graticule, halo, libVersion, setGDALconfig, map.pal, map_extent, north, sbar, terraOptions, tmpFiles, makeVRT, mem_info, free_RAM, same.crs, shade, gdalCache, fileBlocksize, vector_layers, vrt_tiles, names, round, unloadGDALdrivers)
24+
export(add_abline, add_box, add_legend, add_grid, add_mtext, ar_info, clearVSIcache, combineLevels, focalMat, extractAlong, gdal, getGDALconfig, graticule, halo, libVersion, proj_ok, setGDALconfig, map.pal, map_extent, north, sbar, terraOptions, tmpFiles, makeVRT, mem_info, free_RAM, same.crs, shade, gdalCache, fileBlocksize, vector_layers, vrt_tiles, names, round, unloadGDALdrivers)
2525

2626

R/RcppExports.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
.Call(`_terra_have_TBB`)
66
}
77

8+
.proj_conf_test <- function() {
9+
.Call(`_terra_proj_conf_test`)
10+
}
11+
812
proj_version <- function() {
913
.Call(`_terra_proj_version`)
1014
}

R/gdal.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ unloadGDALdrivers <- function(x) {
44
.removeDriver(x)
55
}
66

7+
proj_ok <- function() {
8+
.proj_conf_test()
9+
}
10+
711

812
fileBlocksize <- function(x) {
913
v <- x@pntr$getFileBlocksize()

man/gdal.Rd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
\alias{getGDALconfig}
88
\alias{setGDALconfig}
99
\alias{unloadGDALdrivers}
10+
\alias{proj_ok}
11+
1012

1113
\title{GDAL version, supported file formats, and cache size}
1214

@@ -16,6 +18,8 @@ Set the \code{GDAL} warning level or get a \code{data.frame} with the available
1618
\code{GDAL} is the software library that terra builds on to read and write spatial data and for some raster data processing. \code{PROJ} is used for transformation of coordinates ("projection") and \code{GEOS} is used for geometric operations with vector data.
1719

1820
The current \code{GDAL} configuration options and obtained with \code{getGDALconfig} and changed with \code{setGDALconfig}.
21+
22+
\code{proj_ok} checks if the PROJ database with CRS definitions can be found.
1923
}
2024

2125
\usage{
@@ -26,6 +30,7 @@ getGDALconfig(option)
2630
clearVSIcache()
2731
libVersion(lib="all", parse=FALSE)
2832
unloadGDALdrivers(x)
33+
proj_ok()
2934
}
3035

3136
\arguments{

src/RcppExports.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ BEGIN_RCPP
2020
return rcpp_result_gen;
2121
END_RCPP
2222
}
23+
// proj_conf_test
24+
bool proj_conf_test();
25+
RcppExport SEXP _terra_proj_conf_test() {
26+
BEGIN_RCPP
27+
Rcpp::RObject rcpp_result_gen;
28+
Rcpp::RNGScope rcpp_rngScope_gen;
29+
rcpp_result_gen = Rcpp::wrap(proj_conf_test());
30+
return rcpp_result_gen;
31+
END_RCPP
32+
}
2333
// proj_version
2434
std::string proj_version();
2535
RcppExport SEXP _terra_proj_version() {
@@ -443,6 +453,7 @@ RcppExport SEXP _rcpp_module_boot_spat();
443453

444454
static const R_CallMethodDef CallEntries[] = {
445455
{"_terra_have_TBB", (DL_FUNC) &_terra_have_TBB, 0},
456+
{"_terra_proj_conf_test", (DL_FUNC) &_terra_proj_conf_test, 0},
446457
{"_terra_proj_version", (DL_FUNC) &_terra_proj_version, 0},
447458
{"_terra_hex2rgb", (DL_FUNC) &_terra_hex2rgb, 1},
448459
{"_terra_rgb2hex", (DL_FUNC) &_terra_rgb2hex, 1},

src/RcppFunctions.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
#endif
4343

4444

45-
4645
// [[Rcpp::export(name = ".have_TBB")]]
4746
bool have_TBB() {
4847
#ifdef HAVE_TBB
@@ -53,6 +52,17 @@ bool have_TBB() {
5352
}
5453

5554

55+
// [[Rcpp::export(name = ".proj_conf_test")]]
56+
bool proj_conf_test() {
57+
PJ *crs = proj_create(nullptr, "EPSG:4326");
58+
if (!crs) {
59+
return false;
60+
}
61+
proj_destroy(crs);
62+
return true;
63+
}
64+
65+
5666
//from sf
5767
#ifdef projh
5868
// [[Rcpp::export]]

0 commit comments

Comments
 (0)