Skip to content

Commit

Permalink
Fix forthcoming error with rgdal 1.5-6 #299
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Romain committed Apr 1, 2020
1 parent 2aa9d59 commit c8224ae
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion R/plot.r
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ setMethod("plot", signature(x = "LASheader", y = "missing"), function(x, y, mapv
{
epsg <- epsg(x)
PHB <- x@PHB
crs <- tryCatch({sp::CRS(glue::glue("+init=epsg:{epsg}"))}, error = function(e) return(sp::CRS()))
crs <- epsg2CRS(epsg)
xmin <- PHB[["Min X"]]
xmax <- PHB[["Max X"]]
ymin <- PHB[["Min Y"]]
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-LAS.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ test_that("LAS builds a LAS object with a CRS", {

las2 <- LAS(data, las@header)

expect_equal(projection(las2), "+proj=utm +zone=17 +datum=NAD83 +units=m +no_defs +ellps=GRS80 +towgs84=0,0,0")
expect_equal(projection(las2), projection(las))
expect_equal(epsg(las2), 26917)

las2 <- LAS(data, proj4string = las@proj4string)

expect_equal(projection(las2), "+proj=utm +zone=17 +datum=NAD83 +units=m +no_defs +ellps=GRS80 +towgs84=0,0,0")
expect_equal(projection(las2), projection(las))
#expect_equal(epsg(las2), 26917)
})

Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-grid_canopy.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test_that("grid_canopy with p2r() returns a georeferenced RasterLayer", {
expect_equal(raster::res(x), c(4,4))
expect_equal(dim(x), c(25,25,1))
expect_equal(raster::extent(x), raster::extent(0,100,0,100))
expect_equal(x@crs, las@proj4string)
expect_equal(projection(x), projection(las))
expect_equal(names(x), "Z")
})

Expand Down Expand Up @@ -80,7 +80,7 @@ test_that("grid_canopy tin works both with LAS and LAScatalog", {
expect_equal(raster::res(x), c(1,1))
expect_equal(dim(x), c(88,88,1))
expect_equal(raster::extent(x), raster::extent(481261,481349,3812922,3813010))
expect_equal(x@crs, las@proj4string)
expect_equal(projection(x), projection(las))
expect_equal(names(x), "Z")
expect_equal(x, y, tolerance = 0.00065)
})
Expand All @@ -97,7 +97,7 @@ test_that("grid_canopy pit-free works both with LAS and LAScatalog", {
expect_equal(raster::res(x), c(1,1))
expect_equal(dim(x), c(88,88,1))
expect_equal(raster::extent(x), raster::extent(481261,481349,3812922,3813010))
expect_equal(x@crs, las@proj4string)
expect_equal(projection(x), projection(las))
expect_equal(names(x), "Z")
expect_equal(x, y, tolerance = 0.00079)
})
Expand Down

0 comments on commit c8224ae

Please sign in to comment.