Skip to content

Commit

Permalink
docs: add st_erase example
Browse files Browse the repository at this point in the history
  • Loading branch information
elipousson committed Sep 15, 2023
1 parent 03f03ea commit 29f2846
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 8 deletions.
2 changes: 1 addition & 1 deletion R/st_erase.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#' @param union If `TRUE`, use [sf::st_combine()] and [sf::st_union()] on y
#' before applying difference/intersection; defaults to `TRUE`.
#' @inheritParams sf::st_difference
#' @examples examples/st_erase.R
#' @example examples/st_erase.R
#' @export
#' @importFrom sf st_union st_combine st_intersection st_difference
st_erase <- function(x, y, flip = FALSE, union = TRUE, combine = FALSE, ...) {
Expand Down
19 changes: 19 additions & 0 deletions examples/st_erase.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
nc <- read_sf_ext(system.file("shape/nc.shp", package = "sf"))

nc <- st_transform_ext(nc, 3657)

plot(
st_erase(
st_buffer(nc[1, ], 1000),
nc[1, ]
),
max.plot = 1
)

plot(
st_trim(
nc,
st_buffer(nc[1, ], 2000)
),
max.plot = 1
)
36 changes: 29 additions & 7 deletions man/st_erase.Rd

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

0 comments on commit 29f2846

Please sign in to comment.