Skip to content

Commit 5c84e2f

Browse files
committed
return fast for default Spatial objects with unset CRS
This restores the fix for #125 that got lost in #138.
1 parent e60dedf commit 5c84e2f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

R/projected.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ setMethod("is.projected", signature(obj = "Spatial"), is.projectedSpatial)
8080
is.projectedCRS <- function(obj) {
8181
p4str <- slot(obj, "projargs")
8282
wkt2 <- comment(obj)
83+
if (is.null(wkt2) && is.na(p4str)) # fast track for default objects
84+
return(NA)
8385
if (requireNamespace("sf", quietly = TRUE)) {
8486
o <- try(sf::st_is_longlat(obj), silent=TRUE)
8587
# 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
@@ -92,8 +94,6 @@ is.projectedCRS <- function(obj) {
9294
warning("Package sf not available")
9395
if (!is.null(wkt2)) # and old rgdal version
9496
substring(wkt2, 1, 3) != "GEO"
95-
else if (is.na(p4str) || !nzchar(p4str))
96-
as.logical(NA)
9797
else
9898
length(grep("longlat", p4str, fixed = TRUE)) == 0L
9999
}

0 commit comments

Comments
 (0)