ropensci / CoordinateCleaner

Automated flagging of common spatial and temporal errors in biological and palaeontological collection data, for the use in conservation, ecology and palaeontology.
https://docs.ropensci.org/CoordinateCleaner/
79 stars 21 forks source link

CoordinateCleaner vulnerable to forthcoming changes in sp and rgdal #34

Closed rsbivand closed 4 years ago

rsbivand commented 4 years ago

Running revdep checks for current rgdal on R-Forge - see:

https://stat.ethz.ch/pipermail/r-sig-geo/2019-November/027801.html

shows the errors in the check log extract below, related to use of PROJ&/GDAL3 and required changes to sp and rgdal. If useful find a regerence to a docker image in this thread:

https://github.com/r-spatial/discuss/issues/28

Changes will occur quite fast, and packages need to be prepared.

* checking examples ... ERROR
Running examples in ‘CoordinateCleaner-Ex.R’ failed
The error most likely occurred in:

> ### Name: cc_sea
> ### Title: Identify Non-terrestrial Coordinates
> ### Aliases: cc_sea
> ### Keywords: Coordinate cleaning
> 
> ### ** Examples
> 
> 
> x <- data.frame(species = letters[1:10], 
+                 decimallongitude = runif(10, -30, 30), 
+                 decimallatitude = runif(10, -30, 30))
>                 
> cc_sea(x, value = "flagged")
Testing sea coordinates
Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum WGS_1984 in CRS definition,
 but +towgs84= values preserved
trying URL 'http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/physical/ne_110m_land.zip'
Content type 'application/zip' length 69700 bytes (68 KB)
==================================================
downloaded 68 KB

OGR data source with driver: ESRI Shapefile 
Source: "/tmp/RtmpjUIIfj", layer: "ne_110m_land"
with 127 features
It has 3 fields
Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum Unknown_based_on_WGS84_ellipsoid in CRS definition,
 but +towgs84= values preserved
Error in .local(x, y, returnList, fn, ...) : 
  identicalCRS(x, y) is not TRUE
Calls: cc_sea -> <Anonymous> -> <Anonymous> -> .local -> stopifnot
Execution halted
rsbivand commented 4 years ago

Please respond ASAP. Still:

* checking examples ... ERROR
Running examples in ‘CoordinateCleaner-Ex.R’ failed
The error most likely occurred in:

> ### Name: cc_sea
> ### Title: Identify Non-terrestrial Coordinates
> ### Aliases: cc_sea
> ### Keywords: Coordinate cleaning
> 
> ### ** Examples
> 
> 
> x <- data.frame(species = letters[1:10], 
+                 decimallongitude = runif(10, -30, 30), 
+                 decimallatitude = runif(10, -30, 30))
>                 
> cc_sea(x, value = "flagged")
Testing sea coordinates
Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum WGS_1984 in CRS definition,
 but +towgs84= values preserved
trying URL 'http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/physical/ne_110m_land.zip'
Content type 'application/zip' length 69700 bytes (68 KB)
==================================================
downloaded 68 KB

OGR data source with driver: ESRI Shapefile 
Source: "/tmp/RtmplVtT4h", layer: "ne_110m_land"
with 127 features
It has 3 fields
Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum Unknown based on WGS84 ellipsoid in CRS definition,
 but +towgs84= values preserved
Error in .local(x, y, returnList, fn, ...) : 
  identicalCRS(x, y) is not TRUE
Calls: cc_sea -> <Anonymous> -> <Anonymous> -> .local -> stopifnot
Execution halted

rgdal release impending, PROJ > 5 and GDAL > 2 on some CRAN test machines. When rgdal is released, your package will fail with the example above.

azizka commented 4 years ago

Thanks for the heads up and all the resources on the topic. No idea how to find the time to address this.

rsbivand commented 4 years ago

Typically either stop checking for identities, or update workflows to use the modern representations. Identity should not be expected without careful consideration of the input representations being compared. 1984 was a long time ago.

azizka commented 4 years ago

Addressed this with the help of @mdsumner for version 2.0-15 now and submitted to CRAN. Hope it will work now.

azizka commented 4 years ago

Seems to work, I will close this issue for now