Skip to content

Commit 92d2a83

Browse files
authored
Merge pull request #149 from rolfsimoes/b-1.0.0-beta
Pre-release 1.0.0
2 parents dcf9098 + b6aba27 commit 92d2a83

File tree

8 files changed

+50
-5
lines changed

8 files changed

+50
-5
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@
1313
^Meta$
1414
^\.github$
1515
^revdep$
16+
^cran-comments\.md$

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,5 @@ docs
4242
inst/doc
4343
/doc/
4444
/Meta/
45+
/revdep/
46+
cran-comments.md

DESCRIPTION

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,3 @@ Collate:
8080
'rstac.R'
8181
'rstac-funs.R'
8282
Roxygen: list(markdown = TRUE)
83-
VignetteBuilder: knitr

NAMESPACE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ S3method(items_properties,doc_items)
7171
S3method(items_reap,default)
7272
S3method(items_reap,doc_item)
7373
S3method(items_reap,doc_items)
74+
S3method(items_select,doc_items)
7475
S3method(items_sign,default)
7576
S3method(items_sign,doc_item)
7677
S3method(items_sign,doc_items)
@@ -201,6 +202,7 @@ export(items_matched)
201202
export(items_next)
202203
export(items_properties)
203204
export(items_reap)
205+
export(items_select)
204206
export(items_sign)
205207
export(items_sign_bdc)
206208
export(items_sign_planetary_computer)

NEWS.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# rstac (development version)
2-
31
# rstac 1.0.0 (Released 2024-02-14)
42

53
* Add support to static catalogs;

R/items-funs.R

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@
7777
#'
7878
#' @param geom a `sf` or `sfc` object.
7979
#'
80+
#' @param selection an `integer` vector containing the indices of the items
81+
#' to select.
82+
#'
8083
#' @param ... additional arguments. See details.
8184
#'
8285
#' @details
@@ -153,6 +156,8 @@
153156
#' \item `items_properties()`: returns a `character` value with all properties
154157
#' of all items.
155158
#'
159+
#' \item `items_select()`: select features from an items object.
160+
#'
156161
#' }
157162
#'
158163
#' @examples
@@ -215,6 +220,8 @@
215220
#'
216221
#' stac_item %>% items_as_tibble()
217222
#'
223+
#' stac_item %>% items_select(c(1, 4, 10, 20))
224+
#'
218225
#' }
219226
#'
220227
#' @name items_functions
@@ -751,3 +758,26 @@ items_properties.doc_items <- function(items) {
751758
names(item$properties)
752759
}))))
753760
}
761+
762+
#' @rdname items_functions
763+
#'
764+
#' @export
765+
items_select <- function(items, selection) {
766+
UseMethod("items_select", items)
767+
}
768+
769+
#' @rdname items_functions
770+
#'
771+
#' @export
772+
items_select.doc_items <- function(items, selection) {
773+
check_items(items)
774+
items$features <- items$features[selection]
775+
# clear numberMatched information
776+
if ("search:metadata" %in% names(items))
777+
items$`search:metadata`$matched <- NULL
778+
if ("context" %in% names(items))
779+
items$`context`$matched <- NULL
780+
if ("numberMatched" %in% names(items))
781+
items$numberMatched <- NULL
782+
items
783+
}

man/items_functions.Rd

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/rstac.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)