Skip to content

Commit

Permalink
document ... correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
olivroy committed Sep 2, 2024
1 parent ac32831 commit 4bac3db
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
18 changes: 10 additions & 8 deletions R/nearest.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#' get nearest points between pairs of geometries
#' Get nearest points between pairs of geometries
#'
#' get nearest points between pairs of geometries
#' @param x object of class \code{sfg}, \code{sfc} or \code{sf}
#' @param y object of class \code{sfg}, \code{sfc} or \code{sf}
#' @param pairwise logical; if \code{FALSE} (default) return nearest points between all pairs, if \code{TRUE}, return nearest points between subsequent pairs.
#' @param ... ignored
#' @param x,y object of class \code{sfg}, \code{sfc} or \code{sf}
#' @param pairwise logical; if \code{FALSE} (default) return nearest points between all pairs,
#' if \code{TRUE}, return nearest points between subsequent pairs.
#' @param ... passed on to methods. Currently, only `pairwise` is implemented.
#' @seealso \link{st_nearest_feature} for finding the nearest feature
#' @return an \link{sfc} object with all two-point \code{LINESTRING} geometries of point pairs from the first to the second geometry, of length x * y, with y cycling fastest. See examples for ideas how to convert these to \code{POINT} geometries.
#' @return an \link{sfc} object with all two-point \code{LINESTRING} geometries of point pairs from the first to the second geometry, of length x * y, with y cycling fastest.
#' See examples for ideas how to convert these to \code{POINT} geometries.
#' @details in case \code{x} lies inside \code{y}, when using S2, the end points
#' are on polygon boundaries, when using GEOS the end point are identical to \code{x}.
#' @examples
Expand Down Expand Up @@ -34,6 +35,7 @@
#' plot(pts[seq(2, 200, 2)], add = TRUE, col = 'green')
#'
#' @export
#'
st_nearest_points = function(x, y, ...) UseMethod("st_nearest_points")

#' @export
Expand All @@ -55,13 +57,13 @@ st_nearest_points.sfc = function(x, y, ..., pairwise = FALSE) {
}

#' @export
#' @name st_nearest_points
#' @rdname st_nearest_points
st_nearest_points.sfg = function(x, y, ...) {
st_nearest_points(st_geometry(x), st_geometry(y), ...)
}

#' @export
#' @name st_nearest_points
#' @rdname st_nearest_points
st_nearest_points.sf = function(x, y, ...) {
st_nearest_points(st_geometry(x), st_geometry(y), ...)
}
Expand Down
14 changes: 7 additions & 7 deletions man/st_nearest_points.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4bac3db

Please sign in to comment.