MikkoVihtakari / ggOceanMaps

Plot oceanographic research data on maps using ggplot2
GNU General Public License v3.0
45 stars 7 forks source link

Please remove dependencies on **rgdal**, **rgeos**, and/or **maptools** #18

Closed rsbivand closed 1 year ago

rsbivand commented 1 year ago

This package depends on (depends, imports or suggests) raster and one or more of the retiring packages rgdal, rgeos or maptools (https://r-spatial.org/r/2022/04/12/evolution.html, https://r-spatial.org/r/2022/12/14/evolution2.html). Since raster 3.6.3, all use of external FOSS library functionality has been transferred to terra, making the retiring packages very likely redundant. It would help greatly if you could remove dependencies on the retiring packages as soon as possible.

Maybe related to #5

MikkoVihtakari commented 1 year ago

Thanks Roger. Will do so. When the rosm package dependencies are fixed, detaching rgdal should be straight forward.

Related to this: https://github.com/paleolimbot/ggspatial/issues/110

rsbivand commented 1 year ago

Does this mean that the use of rgeos in rgeos::createSPComment (fixed by https://github.com/r-spatial/sf/pull/2069), rgeos::gDistance rgeos::gIntersection rgeos::gIsValid rgeos::gSimplify in code is also removed? I don't see rgeos being removed from NAMESPACE, even in the sf-version branch. If need be, use sf_use_s2(FALSE) to emulate rgeos.

MikkoVihtakari commented 1 year ago

Yes, I forgot rgeos. I'd need to rewrite many functions. Fixing that has to wait some time.

rsbivand commented 1 year ago

This package has strong dependence on at least one of rgdal, rgeos or maptools, but does not seem to use any functionality in code. The usage may have been in raster, which now uses terra instead, or may be in examples or vignettes. Please move all use of rgdal, rgeos or maptools to Suggests: and protect any use against these packages not being present. The packages will be archived in October 2023. See https://r-spatial.org/r/2022/12/14/evolution2.html and https://rsbivand.github.io/csds_jan23/bivand_csds_ssg_230117.pdf and perhaps view https://www.youtube.com/watch?v=TlpjIqTPMCA&list=PLzREt6r1NenmWEidssmLm-VO_YmAh4pq9&index=1.

MikkoVihtakari commented 1 year ago

Thanks, will fix before October.

rsbivand commented 1 year ago

Thanks! If you can manage June (when we switch sp from using rgdal to using sf internally, evolution status 2), that would be helpful, as we are unsure what that may lead to when packages interact.

rsbivand commented 1 year ago

Please also see https://r-spatial.org/r/2023/04/10/evolution3.html, fix best by June, latest October 2023.

MikkoVihtakari commented 1 year ago

Ok, understood. I have a lot to do at work these days but will manage to uncouple sp, rgdal, rgeos and raster latest by October 2023.

rsbivand commented 1 year ago

You may safely leave sp and raster, only rgdal, rgeos and maptools are retiring. https://r-spatial.org/r/2023/04/10/evolution3.html has lots of hints on work-arounds.

MikkoVihtakari commented 1 year ago

Should be done now: https://github.com/mikkovihtakari/ggoceanmaps/tree/sf-version

It goes to CRAN once I have controlled that everything works.

rsbivand commented 1 year ago

Looks good to go here, sp status 2 and without retiring packages on the search path; thanks!

MikkoVihtakari commented 1 year ago

@rsbivand, any idea why ggOceanMaps still imports sp, raster and rgeos even though these are not mentioned anywhere in DESCRIPTION nor NAMESPACE? Here is the entire branch: https://github.com/MikkoVihtakari/ggOceanMaps/tree/sf-version

library(ggOceanMaps)
#> Loading required package: ggplot2
#> ggOceanMaps: Setting data download folder to a temporary folder
#> /var/folders/9v/b70pd53x04d3jjmlrbcgp4_w0000gv/T//RtmpcEjorI. This
#> means that any downloaded map data need to be downloaded again when you
#> restart R. To avoid this problem, change the default path to a
#> permanent folder on your computer. Add following lines to your
#> .Rprofile file: {.ggOceanMapsenv <- new.env(); .ggOceanMapsenv$datapath
#> <- 'YourCustomPath'}. You can use usethis::edit_r_profile() to edit the
#> file.'~/Documents/ggOceanMapsLargeData'would make it in a writable
#> folder on most operating systems.

pack <- available.packages()
pack["ggOceanMaps","Imports"]
#> [1] "sp, raster, sf, rgeos, methods, utils, stars, smoothr, units,\ndplyr, parallel"

Created on 2023-07-04 with reprex v2.0.2

Here is session info in case it helps

library(ggOceanMaps)
#> Loading required package: ggplot2
#> ggOceanMaps: Setting data download folder to a temporary folder
#> /var/folders/9v/b70pd53x04d3jjmlrbcgp4_w0000gv/T//RtmpzXoXAz. This
#> means that any downloaded map data need to be downloaded again when you
#> restart R. To avoid this problem, change the default path to a
#> permanent folder on your computer. Add following lines to your
#> .Rprofile file: {.ggOceanMapsenv <- new.env(); .ggOceanMapsenv$datapath
#> <- 'YourCustomPath'}. You can use usethis::edit_r_profile() to edit the
#> file.'~/Documents/ggOceanMapsLargeData'would make it in a writable
#> folder on most operating systems.

sessionInfo()
#> R version 4.3.1 (2023-06-16)
#> Platform: x86_64-apple-darwin20 (64-bit)
#> Running under: macOS Ventura 13.3.1
#> 
#> Matrix products: default
#> BLAS:   /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRblas.0.dylib 
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0
#> 
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#> 
#> time zone: Europe/Oslo
#> tzcode source: internal
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] ggOceanMaps_2.0.0 ggplot2_3.4.2    
#> 
#> loaded via a namespace (and not attached):
#>  [1] lwgeom_0.2-13      gtable_0.3.3       dplyr_1.1.2        compiler_4.3.1    
#>  [5] reprex_2.0.2       tidyselect_1.2.0   Rcpp_1.0.10        parallel_4.3.1    
#>  [9] scales_1.2.1       yaml_2.3.7         fastmap_1.1.1      R6_2.5.1          
#> [13] generics_0.1.3     classInt_0.4-9     sf_1.0-13          knitr_1.43        
#> [17] tibble_3.2.1       stars_0.6-1        units_0.8-2        munsell_0.5.0     
#> [21] DBI_1.1.3          pillar_1.9.0       rlang_1.1.1        utf8_1.2.3        
#> [25] xfun_0.39          fs_1.6.2           cli_3.6.1          withr_2.5.0       
#> [29] magrittr_2.0.3     class_7.3-22       digest_0.6.32      grid_4.3.1        
#> [33] rstudioapi_0.14    lifecycle_1.0.3    vctrs_0.6.3        KernSmooth_2.23-21
#> [37] proxy_0.4-27       evaluate_0.21      glue_1.6.2         abind_1.4-5       
#> [41] fansi_1.0.4        e1071_1.7-13       colorspace_2.1-0   rmarkdown_2.23    
#> [45] tools_4.3.1        pkgconfig_2.0.3    htmltools_0.5.5

Created on 2023-07-04 with reprex v2.0.2

rsbivand commented 1 year ago

available.packages looks at the package on CRAN, not the locally installed package. 2.0.0 arrived earlier today, but all the CRAN checks https://cran.r-project.org/web/checks/check_results_ggOceanMaps.html are for the previous version, as is:

> pack["ggOceanMaps", c("Version", "Depends", "Imports")]
                                                                         Version 
                                                                         "1.3.4" 
                                                                         Depends 
                                              "R (>= 3.5.0), ggplot2, ggspatial" 
                                                                         Imports 
"sp, raster, sf, rgeos, methods, utils, stars, smoothr, units,\ndplyr, parallel" 

I'd expect the databases to synch within about 24 hours.

MikkoVihtakari commented 1 year ago

Thanks for the clarification :) Well, it should only use sf and stars now. I hope you can retire soon :)

rsbivand commented 1 year ago

Yes, just 206 packages left to help ... thanks for your help!