Skip to content

Commit

Permalink
Separate the old deprecated function docs and make it internal + add …
Browse files Browse the repository at this point in the history
…backward compat
  • Loading branch information
olivroy committed Feb 14, 2024
1 parent 2c2fee3 commit 83bf395
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions R/perimeter.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' compute perimeter from polygons or other geometries
#' Compute perimeter from polygons or other geometries
#'
#' @name perimeter
#' @param x object of class \code{sf}, \code{sfc} or \code{sfg}
Expand All @@ -12,12 +12,21 @@ st_perimeter_lwgeom = function(x) {
ret
}

#' @export
#' @name perimeter
st_perimeter = function(x) .Deprecated("sf::st_perimeter or lwgeom::st_perimeter_lwgeom")
#' compute perimeter from polygons or other geometries
#'
#' Deprecated.
#' Use \code{sf::st_perimeter()} or \code{st_perimeter_lwgeom()} instead.
#' @keywords internal
#' @name perimeter-deprecated
#' @param x object of class \code{sf}, \code{sfc} or \code{sfg}
st_perimeter = function(x) {
.Deprecated("sf::st_perimeter or lwgeom::st_perimeter_lwgeom")
# for back compatibility
st_perimeter_lwgeom(x)
}

#' @export
#' @name perimeter
#' @rdname perimeter
st_perimeter_2d = function(x) {
if (isTRUE(st_is_longlat(x)))
stop("for perimeter of longlat geometry, cast to LINESTRING and use st_length") # nocov
Expand Down

0 comments on commit 83bf395

Please sign in to comment.