diff --git a/.github/workflows/R-CMD-check-autotools.yaml b/.github/workflows/R-CMD-check-autotools.yaml
index d4e3d59..614e0e7 100644
--- a/.github/workflows/R-CMD-check-autotools.yaml
+++ b/.github/workflows/R-CMD-check-autotools.yaml
@@ -21,8 +21,6 @@ jobs:
- {os: ubuntu-latest, r: 'release', PROJ_VERSION: '8.2.1'}
- {os: ubuntu-latest, r: 'release', PROJ_VERSION: '7.2.1'}
- {os: ubuntu-latest, r: 'release', PROJ_VERSION: '6.3.1'}
- - {os: ubuntu-latest, r: 'release', PROJ_VERSION: '5.2.0'}
- - {os: ubuntu-latest, r: 'release', PROJ_VERSION: '4.9.3'}
env:
diff --git a/.github/workflows/R-CMD-check-none.yaml b/.github/workflows/R-CMD-check-none.yaml
deleted file mode 100644
index da2aa0e..0000000
--- a/.github/workflows/R-CMD-check-none.yaml
+++ /dev/null
@@ -1,51 +0,0 @@
-on:
- push:
- branches: [main, no-func]
- pull_request:
- branches: [main]
-
-name: R-CMD-check-proj-none
-
-jobs:
- R-CMD-check-proj-none:
- runs-on: ${{ matrix.config.os }}
-
- name: ${{ matrix.config.os }} (${{ matrix.config.r }}) (${{ matrix.config.PROJ_VERSION }})
-
- strategy:
- fail-fast: false
- matrix:
- config:
- #- {os: macos-latest, r: 'release', PROJ_VERSION: 'cran'}
- #- {os: windows-latest, r: 'release', PROJ_VERSION: 'cran'}
- - {os: ubuntu-latest, r: 'release', PROJ_VERSION: 'none'}
-
- env:
- GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
- R_KEEP_PKG_SOURCE: yes
- PROJ_NUMBER: ${{ matrix.config.PROJ_VERSION }}
-
- steps:
- - uses: actions/checkout@v3
-
- - uses: r-lib/actions/setup-pandoc@v2
-
- - uses: r-lib/actions/setup-r@v2
- with:
- r-version: ${{ matrix.config.r }}
- http-user-agent: ${{ matrix.config.http-user-agent }}
- use-public-rspm: true
-
-
-
- # we don't use r-lib/actions/setup-r-dependencies@v because that slams the from-source install
-
- # - name: Install package installer
- # run: Rscript -e 'install.packages(c("pak"), repos = "https://cran.r-project.org/")'
-
- - name: Install package deps
- run: Rscript -e 'install.packages(c("testthat", "spelling", "knitr", "rmarkdown", "rcmdcheck"))'
-
- - uses: r-lib/actions/check-r-package@v2
- with:
- upload-snapshots: false
diff --git a/DESCRIPTION b/DESCRIPTION
index a6f6afe..43c58b7 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,29 +1,31 @@
Package: PROJ
Title: Generic Coordinate System Transformations Using 'PROJ'
Version: 0.4.5
-Authors@R:
+Authors@R:
c(person(given = "Michael D.",
family = "Sumner",
role = c("aut", "cre"),
email = "mdsumner@gmail.com",
- comment = c(ORCID = "0000-0002-2471-7511")),
- person("Jeroen", "Ooms", role = c("ctb"),
- comment = "provided PROJ library support on Windows, and assistance with Windows configuration"),
- person("Simon", "Urbanek", role = c("cph", "ctb"),
- comment = "wrote original code versions for PROJ version 6"),
- person("Dewey", "Dunnington", role = c("ctb"),
+ comment = c(ORCID = "0000-0002-2471-7511")),
+ person("Jeroen", "Ooms", role = c("ctb"),
+ comment = "provided PROJ library support on Windows, and assistance with Windows configuration"),
+ person("Simon", "Urbanek", role = c("cph", "ctb"),
+ comment = "wrote original code versions for PROJ version 6"),
+ person("Dewey", "Dunnington", role = c("ctb"),
comment = "key code contributions"))
Description: A wrapper around the generic coordinate transformation software 'PROJ'
- that transforms coordinates from one coordinate reference system ('CRS')
- to another. This includes cartographic projections as well as geodetic transformations. The intention is for this
- package to be used by user-packages such as 'reproj', and that the older 'PROJ.4' and version 5
- pathways be provided by the 'proj4' package.
+ that transforms coordinates from one coordinate reference system ('CRS')
+ to another. This includes cartographic projections as well as geodetic transformations. The intention is for this
+ package to be used by user-packages such as 'reproj', and that the older 'PROJ.4' and version 5
+ pathways be provided by the 'proj4' package.
Depends: R (>= 3.0.2)
License: GPL-3
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
-Suggests:
+Imports:
+ lifecycle
+Suggests:
testthat (>= 2.1.0),
spelling,
knitr,
diff --git a/NAMESPACE b/NAMESPACE
index d8dc113..3641c2a 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -4,4 +4,5 @@ export(ok_proj6)
export(proj_crs_text)
export(proj_trans)
export(proj_version)
+importFrom(lifecycle,deprecated)
useDynLib(PROJ, .registration = TRUE)
diff --git a/NEWS.md b/NEWS.md
index 90e2467..8eb215e 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,8 @@
+# PROJ (development version)
+
+* PROJ >= 6 is now a hard dependency (#42)
+* Deprecate ok_proj6() (#42)
+
# PROJ 0.4.5
* New function `proj_version()`.
diff --git a/R/PROJ-package.R b/R/PROJ-package.R
index adc9377..3b9ce21 100644
--- a/R/PROJ-package.R
+++ b/R/PROJ-package.R
@@ -4,6 +4,7 @@
# The following block is used by usethis to automatically manage
# roxygen namespace tags. Modify with care!
## usethis namespace: start
+#' @importFrom lifecycle deprecated
#' @useDynLib PROJ, .registration = TRUE
## usethis namespace: end
NULL
diff --git a/R/ok_proj6.R b/R/ok_proj6.R
index e1d3386..bb3ff1b 100644
--- a/R/ok_proj6.R
+++ b/R/ok_proj6.R
@@ -1,7 +1,11 @@
#' Is 'PROJ library >= 6' available
#'
+#' @description
+#' `r lifecycle::badge("deprecated")`
+#'
#' Test for availability of 'PROJ' system library version 6 or higher.
-#'
+#'
+#' @details
#' On unix-alikes, this function is run in `.onLoad()` to check that version 6 functionality is
#' available. On Windows, the load process sets the data file location with the version 6 API, and that
#' is used as a test instead.
@@ -17,19 +21,6 @@
#' @examples
#' ok_proj6()
ok_proj6 <- function() {
-
- mock_no_proj6 <- getOption("reproj.mock.noproj6")
-
- if (!is.null(mock_no_proj6) && isTRUE(mock_no_proj6)) {
- message("PROJ6 *is* available, but operating in mock-no-proj6 mode '?PROJ::ok_proj6'")
- out <- FALSE
- } else {
- #test <- try(proj_trans(list(x = 0, y = 0),
- ## source = "+proj=longlat +datum=WGS84",
- # target = "+proj=laea"), silent = TRUE)
- #out <- !inherits(test, "try-error")
- out <- !is.na(proj_version())
- }
-
- out
+ lifecycle::deprecate_warn("0.5", "ok_proj6")
+ TRUE
}
diff --git a/R/proj_crs_text.R b/R/proj_crs_text.R
index 6ff11cf..25947a9 100644
--- a/R/proj_crs_text.R
+++ b/R/proj_crs_text.R
@@ -20,17 +20,11 @@
#' @return character string in requested format
#'
#' @examples
-#' if (ok_proj6()) {
#' cat(proj_crs_text("OGC:CRS84", format = 0L))
#' proj_crs_text("OGC:CRS84", format = 1L)
#' south55 <- "+proj=utm +zone=55 +south +ellps=GRS80 +units=m +no_defs +type=crs"
#' proj_crs_text(proj_crs_text(south55), 1L)
-#' }
proj_crs_text <- function(source, format = 0L) {
- if (!ok_proj6()) {
- message("no PROJ lib available")
- return(NA_character_)
- }
stopifnot(length(format) == 1L)
stopifnot(format %in% c(0L, 1L, 2L))
stopifnot(is.character(source))
diff --git a/R/proj_trans.R b/R/proj_trans.R
index 7659ecc..7a255e9 100644
--- a/R/proj_trans.R
+++ b/R/proj_trans.R
@@ -21,16 +21,12 @@
#' @references see the [PROJ library documentation](https://proj.org/development/reference/functions.html#coordinate-transformation)
#' for details on the underlying functionality
#' @examples
-#' if (ok_proj6()) {
-#' proj_trans(cbind(147, -42), "+proj=laea", source = "OGC:CRS84")
-#' proj_trans(cbind(147, -42), z_ = -2, "+proj=laea", source = "OGC:CRS84")
-#' proj_trans(cbind(147, -42), z_ = -2, t_ = 1, "+proj=laea", source = "OGC:CRS84")
-#' }
+#' proj_trans(cbind(147, -42), "+proj=laea", source = "OGC:CRS84")
+#' proj_trans(cbind(147, -42), z_ = -2, "+proj=laea", source = "OGC:CRS84")
+#' proj_trans(cbind(147, -42), z_ = -2, t_ = 1, "+proj=laea", source = "OGC:CRS84")
#' @name proj_trans
#' @export
proj_trans <- function(x, target, ..., source = NULL, z_ = NULL, t_ = NULL) {
-
- if (!ok_proj6()) stop("no PROJ lib available")
if (missing(target) || !is.character(target)) stop("target must be a string")
if (is.null(source) || !is.character(source)) stop("source must be provided as a string")
if (is.list(x) || is.data.frame(x)) x <- cbind(x[[1L]], x[[2L]])
diff --git a/R/zzz.R b/R/zzz.R
index fc14050..e804fca 100644
--- a/R/zzz.R
+++ b/R/zzz.R
@@ -19,7 +19,6 @@ PROJ_load_proj <- function() {
## - windows because tools/winlibs.R
## - macos because CRAN mac binary libs, and configure --with-data-copy=yes --with-proj-data=/usr/local/share/proj
- if (!ok_proj6()) packageStartupMessage("no PROJ lib available, {PROJ} requires PROJ lib 6.3.1 or later")
##PROJ data, only if the files are in package (will fix in gdalheaders)
if (file.exists(system.file("proj/nad.lst", package = "PROJ"))) {
prj = system.file("proj", package = "PROJ")[1L]
diff --git a/configure b/configure
index 561dc30..e1977db 100755
--- a/configure
+++ b/configure
@@ -3129,9 +3129,6 @@ if test x$use6 = xyes -a x${proj6api} = xno; then
$as_echo "$as_me: Cannot find working proj.h headers and library.
*** You may need to install libproj-dev or similar! ***
" >&6;}
-else
-CPPFLAGS="-DUSE_PROJ6_API=1 ${CPPFLAGS}"
-
fi
diff --git a/configure.ac b/configure.ac
index 9fd9575..40da386 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,13 +70,9 @@ if test x$use6 = xyes -a x${proj6api} = xno; then
AC_MSG_NOTICE([Cannot find working proj.h headers and library.
*** You may need to install libproj-dev or similar! ***
])
-else
-CPPFLAGS="-DUSE_PROJ6_API=1 ${CPPFLAGS}"
-
fi
-
AC_ARG_VAR([PKG_CPPFLAGS],[custom C preprocessor flags for packages compilation])
AC_ARG_VAR([PKG_LIBS],[custom libraries for package compilation])
diff --git a/man/figures/lifecycle-deprecated.svg b/man/figures/lifecycle-deprecated.svg
new file mode 100644
index 0000000..b61c57c
--- /dev/null
+++ b/man/figures/lifecycle-deprecated.svg
@@ -0,0 +1,21 @@
+
diff --git a/man/ok_proj6.Rd b/man/ok_proj6.Rd
index b760576..a8d6c82 100644
--- a/man/ok_proj6.Rd
+++ b/man/ok_proj6.Rd
@@ -10,6 +10,8 @@ ok_proj6()
logical, \code{TRUE} if the system library 'PROJ >= 6'
}
\description{
+\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}}
+
Test for availability of 'PROJ' system library version 6 or higher.
}
\details{
diff --git a/man/proj_crs_text.Rd b/man/proj_crs_text.Rd
index 81ec780..0d4bcb4 100644
--- a/man/proj_crs_text.Rd
+++ b/man/proj_crs_text.Rd
@@ -33,10 +33,8 @@ to full WKT, because it is technically a transformation step not a crs. To get t
}
\examples{
-if (ok_proj6()) {
cat(proj_crs_text("OGC:CRS84", format = 0L))
proj_crs_text("OGC:CRS84", format = 1L)
south55 <- "+proj=utm +zone=55 +south +ellps=GRS80 +units=m +no_defs +type=crs"
proj_crs_text(proj_crs_text(south55), 1L)
}
-}
diff --git a/man/proj_trans.Rd b/man/proj_trans.Rd
index fa1cea3..5c513cf 100644
--- a/man/proj_trans.Rd
+++ b/man/proj_trans.Rd
@@ -35,11 +35,9 @@ Values that are detected out of bounds by library PROJ are allowed, we return \c
case, rather than the error "tolerance condition error".
}
\examples{
-if (ok_proj6()) {
- proj_trans(cbind(147, -42), "+proj=laea", source = "OGC:CRS84")
- proj_trans(cbind(147, -42), z_ = -2, "+proj=laea", source = "OGC:CRS84")
- proj_trans(cbind(147, -42), z_ = -2, t_ = 1, "+proj=laea", source = "OGC:CRS84")
- }
+proj_trans(cbind(147, -42), "+proj=laea", source = "OGC:CRS84")
+proj_trans(cbind(147, -42), z_ = -2, "+proj=laea", source = "OGC:CRS84")
+proj_trans(cbind(147, -42), z_ = -2, t_ = 1, "+proj=laea", source = "OGC:CRS84")
}
\references{
see the \href{https://proj.org/development/reference/functions.html#coordinate-transformation}{PROJ library documentation}
diff --git a/src/C_proj_crs_text.c b/src/C_proj_crs_text.c
index 674923d..feb6bd9 100644
--- a/src/C_proj_crs_text.c
+++ b/src/C_proj_crs_text.c
@@ -3,8 +3,6 @@
#include
#include
-#ifdef USE_PROJ6_API
-
#include
SEXP C_proj_crs_text(SEXP crs_, SEXP format)
@@ -67,16 +65,3 @@ SEXP C_proj_crs_text(SEXP crs_, SEXP format)
return(out);
}
-
-
-#else
-
-SEXP C_proj_crs_text(SEXP crs_, SEXP format)
-{
- SEXP out = PROTECT(allocVector(STRSXP, 1));
- SET_STRING_ELT(out, 0, NA_STRING);
- UNPROTECT(1);
- return out;
-}
-
-#endif
diff --git a/src/C_proj_trans.c b/src/C_proj_trans.c
index fc5db03..4795ee0 100644
--- a/src/C_proj_trans.c
+++ b/src/C_proj_trans.c
@@ -1,9 +1,6 @@
#include
-
-#ifdef USE_PROJ6_API
-
#include "proj.h"
// this returns a list of 2 or 4, takes in a list of 2 or 4
@@ -154,20 +151,3 @@ SEXP C_proj_trans_xy(SEXP x_, SEXP y_, SEXP src_, SEXP tgt_)
UNPROTECT(5);
return vec;
}
-
-#else
-
-SEXP C_proj_trans_list(SEXP x, SEXP src_, SEXP tgt_)
-{
- SEXP vec = PROTECT(allocVector(VECSXP, 0));
- UNPROTECT(1);
- return vec;
-}
-SEXP C_proj_trans_xy(SEXP x_, SEXP y_, SEXP src_, SEXP tgt_)
-{
- SEXP vec = PROTECT(allocVector(VECSXP, 0));
- UNPROTECT(1);
-
- return vec;
-}
-#endif
diff --git a/src/C_proj_version.c b/src/C_proj_version.c
index c95eed6..7686700 100644
--- a/src/C_proj_version.c
+++ b/src/C_proj_version.c
@@ -1,8 +1,6 @@
#include
#include
-#ifdef USE_PROJ6_API
-
#include
#define STR_HELPER(x) #x
@@ -14,15 +12,3 @@ SEXP C_proj_version(void)
{
return Rf_mkString(PROJ_PROJ_VERSION);
}
-
-#else
-
-SEXP C_proj_version(void)
-{
- SEXP out = PROTECT(allocVector(STRSXP, 1));
- SET_STRING_ELT(out, 0, NA_STRING);
- UNPROTECT(1);
- return out;
-}
-
-#endif
diff --git a/src/Makevars.ucrt b/src/Makevars.ucrt
index 357bd37..4556704 100644
--- a/src/Makevars.ucrt
+++ b/src/Makevars.ucrt
@@ -4,8 +4,6 @@
LIBSHARPYUV = $(or $(and $(wildcard $(R_TOOLS_SOFT)/lib/libsharpyuv.a),-lsharpyuv),)
PKG_LIBS = -lproj -lsqlite3 -lcurl -lbcrypt -ltiff -ljpeg -lrtmp -lssl -lssh2 -lgcrypt -lcrypto -lgdi32 -lz -lzstd -lwebp $(LIBSHARPYUV) -llzma -lgdi32 -lcrypt32 -lidn2 -lunistring -liconv -lgpg-error -lws2_32 -lwldap32 -lwinmm -lstdc++
-PKG_CPPFLAGS = -DUSE_PROJ6_API=1
-
all: clean winlibs
winlibs:
diff --git a/tests/testthat/test-PROJ.R b/tests/testthat/test-PROJ.R
index 7a0c5d5..0221902 100644
--- a/tests/testthat/test-PROJ.R
+++ b/tests/testthat/test-PROJ.R
@@ -6,7 +6,6 @@ lat <- na.omit(w[,2])
dst <- "+proj=laea +datum=WGS84 +lon_0=147 +lat_0=-42"
test_that("PROJ works", {
-skip_if(!ok_proj6())
src <- "+proj=longlat +datum=WGS84"
expect_silent(xyz <- proj_trans(cbind(X = lon, Y = lat), z_ = rep(0, length(lon)), dst, source = src))
expect_silent(lonlat <- proj_trans(cbind(X = xyz["x_"], Y = xyz["y_"]), z_ = rep(0, length(lon)),
diff --git a/tests/testthat/test-create.R b/tests/testthat/test-create.R
index fcba22e..dfb89af 100644
--- a/tests/testthat/test-create.R
+++ b/tests/testthat/test-create.R
@@ -1,15 +1,7 @@
test_that("create works", {
- testthat::skip_if(!ok_proj6())
wkt2 <- proj_crs_text("+proj=longlat +datum=WGS84 +no_defs +type=crs")
expect_true( grepl("^\\+proj=longlat", proj_crs_text(wkt2, format = 1)))
})
-
-test_that("failure is graceful", {
- ## we *do not* have PROJ lib, so we get NA
- skip_if(ok_proj6())
- expect_true(is.na(proj_crs_text("+proj=longlat", format = 1L)))
- }
-)
diff --git a/tests/testthat/test-out-of-bounds.R b/tests/testthat/test-out-of-bounds.R
index d49ad81..e7cf41e 100644
--- a/tests/testthat/test-out-of-bounds.R
+++ b/tests/testthat/test-out-of-bounds.R
@@ -8,8 +8,6 @@ target <- "+proj=merc +datum=WGS84"
test_that("out of bounds works", {
- skip_if(!ok_proj6())
-
# #here I don't put the expected output because it's (possibly) lib version dependent
## , "Error detected, some values Inf"
a <- expect_output({
diff --git a/tests/testthat/test-sanity-inputs.R b/tests/testthat/test-sanity-inputs.R
index b6ae5de..471bfd1 100644
--- a/tests/testthat/test-sanity-inputs.R
+++ b/tests/testthat/test-sanity-inputs.R
@@ -9,7 +9,6 @@ xy <- cbind(lon, lat)
#xyz <- cbind(lon, lat, 1)
xyzt <- cbind(lon, lat, 1, 0)
test_that("input checks work", {
-skip_if(!ok_proj6())
expect_error(proj_trans(xy), "target must be a string")
expect_error(proj_trans(xy, dst), "source must be provided as a string")
expect_error(proj_trans(xy, 1, source = llproj), "target must be a string")
@@ -32,7 +31,6 @@ skip_if(!ok_proj6())
test_that("PROJ6 checks work", {
- skip_if(!ok_proj6())
expect_error(proj_trans(xy, "myfave", source = llproj))
expect_error(proj_trans(xy, llproj, source = "myfave"))
diff --git a/tests/testthat/test-version.R b/tests/testthat/test-version.R
index bba624e..86189f9 100644
--- a/tests/testthat/test-version.R
+++ b/tests/testthat/test-version.R
@@ -1,5 +1,4 @@
test_that("version string works", {
- skip_if(!ok_proj6())
expect_silent(version <- proj_version())
cat(sprintf("\n\nPROJ VERSION IS: %s\n\n", version))
})