vulnerability to PROJ6/GDAL3 #303
Closed this issue · 6 comments
rsbivand commented
Running revdeps from sp (sp (my github fork) with development rgdal from R-Forge):
> library(testthat)
> library(landscapemetrics)
> library(raster)
Loading required package: sp
>
> test_check("landscapemetrics")
── 1. Failure: spatialize_lsm returns CRS (@test-spatialize-lsm.R#40) ─────────
raster::crs(result[[1]][[1]]) not equal to raster::crs(podlasie_ccilc).
Attributes: < Names: 1 string mismatch >
Attributes: < Length mismatch: comparison on first 2 components >
Attributes: < Component 2: 1 string mismatch >
See:
http://rgdal.r-forge.r-project.org/articles/PROJ6_GDAL3.html
r-spatial/sf#1231
r-spatial/sf#1187
r-spatial/sf#1146
r-spatial/discuss#28
for background. See:
r-spatial/discuss#28 (comment)
for a way of testing fixes in a docker container contributed by Jakub Nowosad.
mhesselbarth commented
@Nowosad Can you tackle this?
Nowosad commented
@mhesselbarth I will take a look at this problem during the next weekend.
Nowosad commented
To reproduce it:
- r-spatial/discuss#28 (comment)
usethis::create_from_github("landscapeecology/landscapemetrics")
remotes::install_github("rsbivand/sp")
install.packages("rgdal", repos="http://R-Forge.R-project.org")
devtools::test(filter = "spatialize-lsm")
Nowosad commented
The issue is with the CRS of the built-in dataset podlasie_ccilc
:
library(landscapemetrics)
library(raster)
#> Loading required package: sp
data("podlasie_ccilc")
podlasie_ccilc
#> class : RasterLayer
#> dimensions : 371, 457, 169547 (nrow, ncol, ncell)
#> resolution : 0.002777778, 0.002777778 (x, y)
#> extent : 22.23056, 23.5, 52.8, 53.83056 (xmin, xmax, ymin, ymax)
#> crs : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0
#> source : memory
#> names : ESACCI.LC.L4.LCCS.Map.300m.P1Y.1992_2015.v2.0.7
#> values : 10, 210 (min, max)
plot(podlasie_ccilc)
#> Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded datum WGS_1984 in CRS definition,
#> but +towgs84= values preserved
#> Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded datum Unknown_based_on_WGS84_ellipsoid in CRS definition,
#> but +towgs84= values preserved
#> Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO"): Discarded datum WGS_1984 in CRS definition,
#> but +towgs84= values preserved
@rsbivand could you advice us on what is the recommend action to fix this issue?
mhesselbarth commented
Thanks for the fix @Nowosad.
Does this mean we can close this issue?
Nowosad commented
I hope so;)