brazil-data-cube / rstac

R Client Library for SpatioTemporal Asset Catalog
https://brazil-data-cube.github.io/rstac
Other
71 stars 16 forks source link

Select items by index in pipe #146

Open kadyb opened 9 months ago

kadyb commented 9 months ago

Is there a way to select items from collection using index in pipe? Currently I do it this way:

library("rstac")

items <- stac("https://brazildatacube.dpi.inpe.br/stac/") |>
  stac_search(collections = "CB4-16D-2", limit = 30) |>
  post_request()

n = c(1, 4, 10, 20)
items$features = items$features[n]
rolfsimoes commented 9 months ago

I've implemented items_select(items, selection) to be released today in version 1.0.0:

library("rstac")

items <- stac("https://brazildatacube.dpi.inpe.br/stac/") |>
  stac_search(collections = "CB4-16D-2", limit = 30) |>
  post_request() |>
  items_select(c(1, 4, 10, 20))
kadyb commented 5 months ago

Thanks! One more small issue. I noticed that items_select() and items_compact() are not listed here:

https://github.com/brazil-data-cube/rstac/blob/b-1.0.1/R/items-funs.R#L7-L52