Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vulnerability to PROJ6/GDAL3 #303 #160

Closed
rsbivand opened this issue Jan 9, 2020 · 6 comments
Closed

vulnerability to PROJ6/GDAL3 #303 #160

rsbivand opened this issue Jan 9, 2020 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@rsbivand
Copy link

rsbivand commented Jan 9, 2020

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
Copy link
Member

@Nowosad Can you tackle this?

@Nowosad
Copy link
Member

Nowosad commented Jan 14, 2020

@mhesselbarth I will take a look at this problem during the next weekend.

@Nowosad Nowosad added the bug Something isn't working label Jan 14, 2020
@Nowosad
Copy link
Member

Nowosad commented Jan 15, 2020

To reproduce it:

  1. PROJ 6 CRS handling changes impact workflows using +datum= (and other fun) r-spatial/discuss#28 (comment)
  2. usethis::create_from_github("landscapeecology/landscapemetrics")
  3. remotes::install_github("rsbivand/sp")
  4. install.packages("rgdal", repos="http://R-Forge.R-project.org")
  5. devtools::test(filter = "spatialize-lsm")

@Nowosad
Copy link
Member

Nowosad commented Jan 15, 2020

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
Copy link
Member

Thanks for the fix @Nowosad.

Does this mean we can close this issue?

@Nowosad
Copy link
Member

Nowosad commented Mar 9, 2020

I hope so;)

@Nowosad Nowosad closed this as completed Mar 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants