Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion R/break_antimeridian.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ st_within_pm180 <- function(x, tol=0.0001) {
xcrs = st_crs(x)
xnames = names(x)
xnames = xnames[grep(attr(x, "sf_column"), xnames, invert=TRUE)]
x$st_within_pm180_ID = as.character(1:nrow(x))
x$st_within_pm180_ID = as.character(seq_len(nrow(x)))
s2_status = sf_use_s2()
sf_use_s2(FALSE) # avoid s2 because we need a planar bounding box
bb0 = st_bbox(x)
Expand Down
4 changes: 2 additions & 2 deletions R/sample.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ st_sample.sfc = function(x, size, ..., type = "random", exact = TRUE, warn_if_no
ret = if (progress) {
if (!requireNamespace("pbapply", quietly = TRUE))
stop("package pbapply required, please install it first")
pbapply::pblapply(1:length(x), function(i) st_sample(x[i], size[i], type = type, exact = exact, ...))
pbapply::pblapply(seq_along(x), function(i) st_sample(x[i], size[i], type = type, exact = exact, ...))
} else
lapply(1:length(x), function(i) st_sample(x[i], size[i], type = type, exact = exact, ...))
lapply(seq_along(x), function(i) st_sample(x[i], size[i], type = type, exact = exact, ...))
st_set_crs(do.call(c, ret), st_crs(x))
} else {
res = switch(max(st_dimension(x)) + 1,
Expand Down
2 changes: 1 addition & 1 deletion R/sp.R
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ st_as_sfc.SpatialPolygons = function(x, ..., precision = 0.0, forceMulti = FALSE
cp0 <- st_contains(raw0[!holes], raw0[holes])
areas <- sapply(slot(pl, "Polygons"), slot, "area")
hole_assigned <- rep(FALSE, sum(holes))
names(cp0) <- 1:length(cp0)
names(cp0) <- seq_along(cp0)
cp1 <- cp0[order(areas[!holes])]
for (i in seq_along(cp1)) {
cp1i <- cp1[[i]]
Expand Down