edzer / sp

Classes and methods for spatial data
http://edzer.github.io/sp/
128 stars 27 forks source link

Request: Move deprecation warning about map-data-related dependencies to functions that use them #139

Closed dvg-p4 closed 1 year ago

dvg-p4 commented 1 year ago

In the latest version of sp, the package prints a lengthy warning message to the console upon being loaded or attached about the deprecation of optional map-related dependencies maptools, rgdal, and rgeos, and their replacement with sf. As far as I can tell, there is not a straightforward way to suppress this message as a package that depends on sp but doesn't use those functions (or has already switched over to sf). So now when e.g. Seurat (a package for storing and analyzing spatial biosample data) loads this package to use its non-geography-related functions, it shows the user a warning that's irrelevant to them as a biologist.

So, I suggest the warning message about these optional dependencies be moved to the start of the functions that actually rely (relied?) on them, so only users and reverse dependencies who are actually using the affected functions will see it. Alternatively, if there is a straightforward way to suppress the message, I suggest you include it as part of the warning itself ("[...]\nThis message can be suppressed by [XYZ]"). Or if that's common knowledge that I've missed, just let me know here :-)

vincentvanhees commented 1 year ago

Also it would be helpful if the warning came with an overview of the dependency paths. For example, I have a package that does not depend on 'sp' but it produces the warning. I suspect it is package geosphere that is the culprit, but it is hard to tell whether geosphere is the only one as there are many other packages in the dependency tree that may also pose a risk.

sanjmeh commented 1 year ago

Is there any update from anyone? it is getting a long winded investigation as to why sp is getting loaded, even when we donot load it directly. To top it all, there is no package that has sp as depends (at least not in the packageDescription()) but why is the warning getting flashed everytime?

edzer commented 1 year ago

The warning will go away in the next version.