-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
77 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# docs ----------------------------------------------------------- # | ||
#' @title Get the area of individual polygons | ||
#' @name area | ||
#' @description Compute the area covered by polygons | ||
#' @param x `giottoPolygon` | ||
#' @param ... additional args to pass | ||
#' @returns `numeric` vector of spatial area | ||
#' @examples | ||
#' sl <- GiottoData::loadSubObjectMini("spatLocsObj") | ||
#' gpoly <- GiottoData::loadSubObjectMini("giottoPolygon") | ||
#' gpoints <- GiottoData::loadSubObjectMini("giottoPoints") | ||
#' | ||
#' # area of polygons | ||
#' area(gpoly) | ||
#' | ||
#' # area of the convex hull | ||
#' area(convHull(sl)) | ||
#' feature_hulls <- convHull(gpoints, by = "feat_ID") | ||
#' area(feature_hulls) | ||
#' | ||
NULL | ||
# ---------------------------------------------------------------- # | ||
|
||
#' @rdname area | ||
#' @export | ||
setMethod("area", signature("giottoPolygon"), function(x, ...) { | ||
# handle warning about missing CRS | ||
handle_warnings(area(x[], ...))$result | ||
}) | ||
|
||
#' @rdname area | ||
#' @export | ||
setMethod("area", signature("SpatVector"), function(x, ...) { | ||
# handle warning about missing CRS | ||
handle_warnings(terra::expanse(x, transform = FALSE, ...))$result | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.