Skip to content

Commit dab16b2

Browse files
authored
Merge branch 'main' into docs
2 parents f6c6b6a + a2baba7 commit dab16b2

File tree

6 files changed

+14
-9
lines changed

6 files changed

+14
-9
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# version 1.0-16
22

3+
* `[.sfc` works when setting argument `op`; #2320
4+
35
* `st_sample()` for polygons is sensitive to setting `oriented = TRUE` to prevent wrongly correcting ring directions; #2308
46

57
* add support for the GDAL `footprint` utility (requiring GDAL >= 3.8.0) to `gdal_utils`; #2305, by @goergen95

R/arith.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
#' S3 Ops Group Generic Functions for simple feature geometries
1+
#' Arithmetic operators for simple feature geometries
22
#' @name Ops
33
#'
44
#' @param e1 object of class \code{sfg} or \code{sfc}
55
#' @param e2 numeric, or object of class \code{sfg}; in case \code{e1} is of class \code{sfc} also an object of class \code{sfc} is allowed
66
#'
7-
#' @details in case \code{e2} is numeric, +, -, *, /, %% and %/% add, subtract, multiply, divide, modulo, or integer-divide by \code{e2}. In case \code{e2} is an n x n matrix, * matrix-multiplies and / multiplies by its inverse. If \code{e2} is an \code{sfg} object, |, /, & and %/% result in the geometric union, difference, intersection and symmetric difference respectively, and \code{==} and \code{!=} return geometric (in)equality, using \link{st_equals}.
7+
#' @details in case \code{e2} is numeric, +, -, *, /, %% and %/% add, subtract, multiply, divide, modulo, or integer-divide by \code{e2}. In case \code{e2} is an n x n matrix, * matrix-multiplies and / multiplies by its inverse. If \code{e2} is an \code{sfg} object, |, /, & and %/% result in the geometric union, difference, intersection and symmetric difference respectively, and \code{==} and \code{!=} return geometric (in)equality, using \link{st_equals}. If `e2` is an `sfg` or `sfc` object, for operations `+` and `-` it has to have `POINT` geometries.
88
#'
99
#' If \code{e1} is of class \code{sfc}, and \code{e2} is a length 2 numeric, then it is considered a two-dimensional point (and if needed repeated as such) only for operations \code{+} and \code{-}, in other cases the individual numbers are repeated; see commented examples.
1010
#'

R/graticule.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#' c( bb[3],bb[4]),c( bb[1],bb[4]),c( bb[1],bb[2])))
3939
#'
4040
#' g = st_graticule(usa)
41-
#' plot(usa, xlim = 1.2 * c(-2450853.4, 2186391.9))
41+
#' plot(usa, xlim = 1.2 * c(-2450853.4, 2186391.9), reset = FALSE)
4242
#' plot(g[1], add = TRUE, col = 'grey')
4343
#' plot(bbox, add = TRUE)
4444
#' points(g$x_start, g$y_start, col = 'red')

R/sfc.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,11 @@ st_sfc = function(..., crs = NA_crs_, precision = 0.0, check_ring_dir = FALSE, d
143143
"[.sfc" = function(x, i, j, ..., op = st_intersects) {
144144
if (!missing(i) && (inherits(i, "sf") || inherits(i, "sfc") || inherits(i, "sfg")))
145145
i = lengths(op(x, i, ...)) != 0
146-
st_sfc(NextMethod(), crs = st_crs(x), precision = st_precision(x),
147-
dim = if(length(x)) class(x[[1]])[1] else "XY")
146+
precision = st_precision(x)
147+
crs = st_crs(x)
148+
dim = if (length(x)) class(x[[1]])[1] else "XY"
149+
x = unclass(x)[i] # now a list
150+
st_sfc(x, crs = crs, precision = precision, dim = dim)
148151
}
149152

150153

R/tidyverse.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ rename_with.sf = function(.data, .fn, .cols, ...) {
261261
ret = dplyr::as_tibble(ret)
262262
ret = st_as_sf(ret, sf_column_name = names(ret)[sf_column_loc])
263263

264-
names(agr) = .fn(names(agr))
264+
names(agr) = .fn(names(agr), ...)
265265
st_agr(ret) = agr
266266
ret
267267
}

man/Ops.Rd

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)