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

sp_2.0-0 draft changing to status 2L #135

Merged
merged 6 commits into from
Jun 20, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions R/projected.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,16 @@ is.projectedCRS <- function(obj) {
if (is.null(wkt2) && is.na(p4str))
as.logical(NA)
else if (get("evolution_status", envir=.spOptions) == 2L) {
if (!requireNamespace("sf", quietly = TRUE))
stop("sf required for evolution_status==2L")
o <- try(sf::st_is_longlat(obj), silent=TRUE)
if (requireNamespace("sf", quietly = TRUE)) {
o <- try(sf::st_is_longlat(obj), silent=TRUE)
# rbgm workaround for +proj=utm +zone=18 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +# +a=6378137.0 +es=0.006694380022900787 +lon_0=-75d00 +lat_0=0d00 +x_0=500000.0 +y_0=0.0 +k=0.9996 in bgmfiles Final_CAM_Boxes_8.bgm
if (inherits(o, "try-error"))
length(grep("longlat", p4str, fixed = TRUE)) == 0L
else
!o
if (inherits(o, "try-error"))
length(grep("longlat", p4str, fixed = TRUE)) == 0L
else
!o
} else {
warning("Package sf not available")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The non-sf case would end up returning a character string (the warning message) rather than a logical as is.projected() should; not sure if this was intended?
Shouldn't the grep-for-longlat-in-p4str fallback be used in the non-sf case as well, maybe returning NA if is.na(p4str) || !nzchar(p4str)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so; I need to check what it returns if anything at all, but warnings are not IIUC returned as strings, they are queued for display depending on the general option setting.

Copy link
Contributor Author

@rsbivand rsbivand Jun 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that today's two commits relieve the problem for the mentioned packages. I'll go ahead and re-run revdeps "most" for sp and the retiring packages - some packages took sp as given if retiring packages were strong dependencies. Will report back with rev-dep outcomes run under _R_CHECK_SUGGESTS_ONLY_=true (the commit message in the second commit should have been warn on missing sf if _SP_STARTUP_MESSAGE_ != "none").

}
} else if (get("evolution_status", envir=.spOptions) == 0L &&
requireNamespace("rgdal", quietly = TRUE) &&
packageVersion("rgdal") >= "1.5.17" && rgdal::new_proj_and_gdal())
Expand Down