Skip to content

Commit

Permalink
clean up st_is_full(); closes #2467
Browse files Browse the repository at this point in the history
  • Loading branch information
edzer committed Nov 3, 2024
1 parent a6f7b12 commit dc990d2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion R/bbox.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ st_bbox.MULTIPOINT = bbox.Mtrx
st_bbox.LINESTRING = bbox.Mtrx
#' @export
#' @name st_bbox
st_bbox.POLYGON = function(obj, ...) if (sf_use_s2() && length(obj) == 1 && nrow(obj[[1]]) == 2) FULL_bbox_ else bbox.MtrxSet(obj)
st_bbox.POLYGON = function(obj, ...) if (st_is_full(obj)) FULL_bbox_ else bbox.MtrxSet(obj)
#' @export
#' @name st_bbox
st_bbox.MULTILINESTRING = bbox.MtrxSet
Expand Down
1 change: 1 addition & 0 deletions R/init.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ pathGrob <- NULL
load_gdal()
if ((s2 <- Sys.getenv("_SF_USE_S2")) != "")
options(sf_use_s2 = s2 != "false")
FULL_bbox_ <<- st_set_crs(FULL_bbox_, "OGC:CRS84")
}

.onUnload = function(libname, pkgname) {
Expand Down
9 changes: 2 additions & 7 deletions R/sfc.R
Original file line number Diff line number Diff line change
Expand Up @@ -641,14 +641,9 @@ st_is_full.sfg = function(x, ..., is_longlat = NULL) {
#' @export
#' @name st_is_full
st_is_full.sfc = function(x, ...) {
if (sf_use_s2() && inherits(x, c("sfc_POLYGON", "sfc_GEOMETRY"))) {
is_longlat = if (!is.null(attr(x, "crs")))
st_is_longlat(x)
else
NA
#sapply(x, st_is_full.sfg, ..., is_longlat = is_longlat)
if (sf_use_s2() && inherits(x, c("sfc_POLYGON", "sfc_GEOMETRY")))
sfc_is_full(x)
} else
else
rep_len(FALSE, length(x))
}

Expand Down

0 comments on commit dc990d2

Please sign in to comment.