Skip to content

Commit

Permalink
vaster_boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsumner committed Jan 29, 2024
1 parent 1cef805 commit 35fabae
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Description: Provides raster grid logic, the grid operations that don't require
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.0
URL: https://github.com/hypertidy/vaster, https://hypertidy.github.io/vaster/
BugReports: https://github.com/hypertidy/vaster/issues
Suggests:
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export(tl)
export(tr)
export(ts)
export(ts_te)
export(vaster_boundary)
export(vaster_listxyz)
export(vaster_long)
export(vcrop)
Expand Down
18 changes: 18 additions & 0 deletions R/coordinates.R
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,21 @@ xy <- function(dimension, extent = NULL) {
cbind(x = x_from_cell(dimension, extent = extent, cell),
y = y_from_cell(dimension, extent = extent, cell))
}


#' Grid boundary in native resolution
#'
#' currently only return centre coords
#' @inheritParams grid
#' @export
#' @examples
#' vaster_boundary(c(3, 4))
vaster_boundary <- function(dimension, extent = NULL) {
extent <- extent %||% extent0(dimension)
.check_args(dimension, extent)
cell <- c(seq_len(dimension[1L]),
seq(dimension[1L], by = dimension[1], length.out = dimension[2L]),
seq(n_cell(dimension), by = -1, length.out = dimension[1L]),
seq(n_cell(dimension) - dimension[1L] + 1, by = -dimension[1], length.out = dimension[2L]))
xy_from_cell(dimension, extent, cell)
}
19 changes: 19 additions & 0 deletions man/vaster_boundary.Rd

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

0 comments on commit 35fabae

Please sign in to comment.