Skip to content

Commit

Permalink
Fix old GDAL/PROJ error with WKT #466
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Romain committed Sep 3, 2021
1 parent 2c3b79f commit 1b3fad1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/projection.R
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ wkt2CRS <- function(wkt, fail = FALSE)
{
if (!rgdal::new_proj_and_gdal())
{
return(sp::CRS(NA_character_))
stop("WKT strings are no longer supported in lidR with old versions of GDAL/PROJ", call. = FALSE)
}

crs <- tryCatch(
Expand Down
6 changes: 5 additions & 1 deletion tests/testthat/test-projection.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ test_that("epsg<- works", {

test_that("Set an invalid code or WKT fails", {
expect_error({ epsg(las) <- 200800 }, "Invalid epsg")
expect_error({ wkt(las) <- "INVALID" }, "Invalid WKT")

if (rgdal::new_proj_and_gdal())
expect_error({ wkt(las) <- "INVALID" }, "Invalid WKT")
else
expect_error({ wkt(las) <- "INVALID" }, "WKT strings are no longer supported with old versions of GDAL/PROJ")
})

test_that("#323 do not segfault", {
Expand Down

0 comments on commit 1b3fad1

Please sign in to comment.