diff --git a/DESCRIPTION b/DESCRIPTION index df0441ff..02f18c97 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: rstac -Title: R Client Library for SpatioTemporal Asset Catalog +Title: Client Library for SpatioTemporal Asset Catalog Version: 0.9.0 Authors@R: c(person("Brazil Data Cube Team", @@ -7,12 +7,9 @@ Authors@R: role = c("cre", "aut")), person(given = "National Institute for Space Research (INPE)", role = c("cph"))) -Description: - R client library for STAC is a R package that interfaces STAC API - endpoints. - For more information about the STAC specification, please consult the - specification page (). - This package supports the version 0.8.1 or higher of the STAC specification. +Description: Provides functions to access, search and download spacetime earth + observation data via SpatioTemporal Asset Catalog (STAC). This package + supports the version 0.8.1 or higher of the STAC specification. License: MIT + file LICENSE URL: https://github.com/brazil-data-cube/rstac BugReports: https://github.com/brazil-data-cube/rstac/issues diff --git a/LICENSE b/LICENSE index d802d2aa..0f56a935 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,2 @@ -MIT License - -Copyright (c) 2020 National Institute for Space Research (INPE) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +YEAR: 2020 +COPYRIGHT HOLDER: National Institute for Space Research (INPE) diff --git a/R/collections.R b/R/collections.R index 21abd994..150dd875 100644 --- a/R/collections.R +++ b/R/collections.R @@ -29,7 +29,7 @@ #' to STAC API web service. #' #' @examples -#' \dontrun{ +#' \donttest{ #' #' stac("http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1", #' force_version = "0.8.1") %>% @@ -95,7 +95,10 @@ params_post_request.collections <- function(s, enctype) { content_get_response.collections <- function(s, res) { # detect expected response object class - content_class <- "stac_collection_list" + if (s$version < "0.9.0") + content_class <- "stac_catalog" + else + content_class <- "stac_collection_list" if (!is.null(s$params[["collection_id"]])) content_class <- "stac_collection" diff --git a/R/ext_query.R b/R/ext_query.R index a24cde49..eae33eba 100644 --- a/R/ext_query.R +++ b/R/ext_query.R @@ -60,7 +60,7 @@ #' passed to \code{post_request} function. #' #' @examples -#' \dontrun{ +#' \donttest{ #' # filter items that has 'bdc:tile' property equal to '022024' #' stac(url = "http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1", #' force_version = "0.8.1") %>% diff --git a/R/items.R b/R/items.R index 2994bb59..3b6fd4cf 100644 --- a/R/items.R +++ b/R/items.R @@ -74,7 +74,7 @@ #' to STAC API web service. #' #' @examples -#' \dontrun{ +#' \donttest{ #' #' stac("http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1", #' force_version = "0.8.1") %>% diff --git a/R/items_fetch.R b/R/items_fetch.R index 7749910d..a880ea70 100644 --- a/R/items_fetch.R +++ b/R/items_fetch.R @@ -24,7 +24,7 @@ #' @return a \code{stac_item_collection} object. #' #' @examples -#' \dontrun{ +#' \donttest{ #' #' stac("http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1", #' force_version = "0.8.1") %>% diff --git a/R/items_length.R b/R/items_length.R index 771fdc3c..84e8f1f9 100644 --- a/R/items_length.R +++ b/R/items_length.R @@ -11,7 +11,7 @@ #' An \code{integer} value. #' #' @examples -#' \dontrun{ +#' \donttest{ #' #' stac("http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1", #' force_version = "0.8.1") %>% diff --git a/R/items_matched.R b/R/items_matched.R index 2c69d345..cecb5139 100644 --- a/R/items_matched.R +++ b/R/items_matched.R @@ -14,7 +14,7 @@ #' extension, returns \code{NULL}. #' #' @examples -#' \dontrun{ +#' \donttest{ #' #' stac("http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1", #' force_version = "0.8.1") %>% diff --git a/R/print.R b/R/print.R index b255838a..d544122d 100644 --- a/R/print.R +++ b/R/print.R @@ -48,7 +48,7 @@ #' \code{\link{items}} #' #' @examples -#' \dontrun{ +#' \donttest{ #' #' # stac_item_collection object #' stac_item_collection <- stac("http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1", diff --git a/R/request.R b/R/request.R index e03bb2aa..5c941eb9 100644 --- a/R/request.R +++ b/R/request.R @@ -35,7 +35,7 @@ #' argument. #' #' @examples -#' \dontrun{ +#' \donttest{ #' #' stac("http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1", #' force_version = "0.8.1") %>% diff --git a/R/stac.R b/R/stac.R index 9e218603..25f84667 100644 --- a/R/stac.R +++ b/R/stac.R @@ -26,7 +26,7 @@ #' parameters to be provided to API service. #' #' @examples -#' \dontrun{ +#' \donttest{ #' #' stac("http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1", #' force_version = "0.8.1") %>% diff --git a/R/stac_search.R b/R/stac_search.R index 88c713b3..131363f1 100644 --- a/R/stac_search.R +++ b/R/stac_search.R @@ -71,7 +71,7 @@ #' to STAC API web service. #' #' @examples -#' \dontrun{ +#' \donttest{ #' # GET request #' stac(url = "http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1", #' force_version = "0.8.1") %>% diff --git a/README.md b/README.md index 5fd91fbc..8114cc91 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ STAC is a specification of files and web services used to describe geospatial information assets. The specification can be consulted in [https://stacspec.org/]. -R client library for STAC (`rstac`) was designed to fully support STAC v0.8.1. +R client library for STAC (`rstac`) was designed to fully support STAC v0.8.1 and v0.9.0. As STAC spec is evolving fast and reaching its maturity, we plan update `rstac` to support upcoming STAC 1.0.0 version soon. @@ -41,24 +41,35 @@ the STAC API of the [Brazil Data Cube](http://brazildatacube.org/) project of the Brazilian National Space Research Institute (INPE). ```R -s_obj <- stac("http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.0") +s_obj <- stac("http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1") get_request(s_obj) %>% print() #### STAC Catalog -#- stac_version: "0.8.0" -#- id: "bdc" -#- description: "Brazil Data Cube Catalog" -#- links: -# - CB4_64 (http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.0/collections/CB4_64) -# - CB4_64_16D_STK (http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.0/collections/CB4_64_16D_STK) -# - CB4_64_16D_STK_v1 (http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.0/collections/CB4_64_16D_STK_v1) -# - CB4_64_v1 (http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.0/collections/CB4_64_v1) -# - CB4A_55 (http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.0/collections/CB4A_55) -# - CB4A_55_1M_STK (http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.0/collections/CB4A_55_1M_STK) -# - CB4MOSBR_64 (http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.0/collections/CB4MOSBR_64) -# - CB4MOSBR_64_1M_STK (http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.0/collections/CB4MOSBR_64_1M_STK) -# - CB4MOSBR_64_3M_MED (http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.0/collections/CB4MOSBR_64_3M_MED) -# - CB4MOSBR_64_3M_STK (http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.0/collections/CB4MOSBR_64_3M_STK) -#> … with 17 more links +# - stac_version: "0.8.1" +# - id: "bdc" +# - description: +# "Brazil Data Cubes Catalog" +# - links: +# - CB4_64 +# (http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1/collections/CB4_64) +# - CB4_64_16D_STK +# (http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1/collections/CB4_64_16D_STK) +# - CB4_64_16D_STK_v1 +# (http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1/collections/CB4_64_16D_STK_v1) +# - CB4_64_v1 +# (http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1/collections/CB4_64_v1) +# - HLS.L30 +# (http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1/collections/HLS.L30) +# - HLS.S30 +# (http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1/collections/HLS.S30) +# - L5DN +# (http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1/collections/L5DN) +# - L5SR +# (http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1/collections/L5SR) +# - L7DN +# (http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1/collections/L7DN) +# - L7SR +# (http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1/collections/L7SR) +# > … with 11 more links ``` The variable `s_obj` stores information to connect to the Brazil Data @@ -138,7 +149,7 @@ download_items <- it_obj %>% The `rstac` package was implemented based on an extensible architecture, so feel free to contribute by implementing new STAC API -[extensions](https://github.com/radiantearth/stac-spec/tree/v0.8.1/api-spec/extensions) +[extensions](https://github.com/radiantearth/stac-spec/tree/v0.9.0/api-spec/extensions) based on the STAC API specifications. 1. Make a project @@ -149,13 +160,13 @@ your extension and implement the S3 generics methods, `params_get_request`, `content_get_response` (for HTTP GET) and/or `params_post_request`, `content_post_response` (for HTTP POST). Using these S3 generics methods you can define how parameters must be submited to the HTTP request and the types -of the returned documents responses. See the implemented [ext_query](https://github.com/OldLipe/rstac/blob/master/R/extension_query.R) +of the returned documents responses. See the implemented [ext_query](https://github.com/brazil-data-cube/rstac/blob/master/R/ext_query.R) API extension as an example. -4. Make a [Pull Request](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request) on the branch dev. +4. Make a [Pull Request](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request) on the branch [dev](https://github.com/OldLipe/rstac/tree/dev). ## Getting help -You can get a full explanation about each STAC (v0.8.1) endpoint at [STAC spec GitHub](https://github.com/radiantearth/stac-spec/tree/v0.8.1). A detailed +You can get a full explanation about each STAC (v0.9.0) endpoint at [STAC spec GitHub](https://github.com/radiantearth/stac-spec/tree/v0.9.0). A detailed documentation with examples on how to use each endpoint and other functions available in the `rstac` package can be obtained by typing `?rstac` in R console. diff --git a/man/collections.Rd b/man/collections.Rd index 8cdbcce3..20c12795 100644 --- a/man/collections.Rd +++ b/man/collections.Rd @@ -30,7 +30,7 @@ Each endpoint retrieves specific STAC objects: } } \examples{ -\dontrun{ +\donttest{ stac("http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1", force_version = "0.8.1") \%>\% diff --git a/man/extension_query.Rd b/man/extension_query.Rd index 92a50b10..5cfe9b9c 100644 --- a/man/extension_query.Rd +++ b/man/extension_query.Rd @@ -63,7 +63,7 @@ to get things done for this extension: } } \examples{ -\dontrun{ +\donttest{ # filter items that has 'bdc:tile' property equal to '022024' stac(url = "http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1", force_version = "0.8.1") \%>\% diff --git a/man/items.Rd b/man/items.Rd index 2eba4b70..94070385 100644 --- a/man/items.Rd +++ b/man/items.Rd @@ -77,7 +77,7 @@ The endpoint \code{/collections/\{collectionId\}/items} accepts the same filters parameters of \code{\link{stac_search}} function. } \examples{ -\dontrun{ +\donttest{ stac("http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1", force_version = "0.8.1") \%>\% diff --git a/man/items_fetch.Rd b/man/items_fetch.Rd index ae017452..2f2dec0a 100644 --- a/man/items_fetch.Rd +++ b/man/items_fetch.Rd @@ -29,7 +29,7 @@ The \code{items_fetch} function returns the pagination of all items of the stac object } \examples{ -\dontrun{ +\donttest{ stac("http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1", force_version = "0.8.1") \%>\% diff --git a/man/items_length.Rd b/man/items_length.Rd index 8a7947d0..6e4a6657 100644 --- a/man/items_length.Rd +++ b/man/items_length.Rd @@ -19,7 +19,7 @@ The \code{items_length} function returns how many items there are in the \code{items} object. } \examples{ -\dontrun{ +\donttest{ stac("http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1", force_version = "0.8.1") \%>\% diff --git a/man/items_matched.Rd b/man/items_matched.Rd index bbc72fb2..fd87055c 100644 --- a/man/items_matched.Rd +++ b/man/items_matched.Rd @@ -22,7 +22,7 @@ The \code{items_matched} returns how many items matched the \code{context} (v0.9.0) STAC API extensions. } \examples{ -\dontrun{ +\donttest{ stac("http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1", force_version = "0.8.1") \%>\% diff --git a/man/print.Rd b/man/print.Rd index fd163994..f63e513b 100644 --- a/man/print.Rd +++ b/man/print.Rd @@ -63,7 +63,7 @@ For printing use the \code{print()} function directly, since the package has } } \examples{ -\dontrun{ +\donttest{ # stac_item_collection object stac_item_collection <- stac("http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1", diff --git a/man/request.Rd b/man/request.Rd index 38d0bdb5..4591568d 100644 --- a/man/request.Rd +++ b/man/request.Rd @@ -45,7 +45,7 @@ The \code{post_request} is function that makes HTTP POST requests to STAC web services, retrieves, and parse the data. } \examples{ -\dontrun{ +\donttest{ stac("http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1", force_version = "0.8.1") \%>\% diff --git a/man/rstac.Rd b/man/rstac.Rd index 4009b3a7..519319af 100644 --- a/man/rstac.Rd +++ b/man/rstac.Rd @@ -6,11 +6,9 @@ \alias{rstac-package} \title{R client library for STAC (rstac)} \description{ -R client library for STAC is a R package that interfaces STAC API - endpoints. - For more information about the STAC specification, please consult the - specification page (). - This package supports the version 0.8.1 or higher of the STAC specification. +Provides functions to access, search and download spacetime earth + observation data via SpatioTemporal Asset Catalog (STAC). This package + supports the version 0.8.1 or higher of the STAC specification. } \section{The \code{rstac} functions}{ diff --git a/man/stac.Rd b/man/stac.Rd index c802c1e7..2881aa9f 100644 --- a/man/stac.Rd +++ b/man/stac.Rd @@ -29,7 +29,7 @@ a STAC API web service. This endpoint should return a STAC Catalog document containing all data Items searchable in the API. } \examples{ -\dontrun{ +\donttest{ stac("http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1", force_version = "0.8.1") \%>\% diff --git a/man/stac_search.Rd b/man/stac_search.Rd index 274a915e..0eab50c0 100644 --- a/man/stac_search.Rd +++ b/man/stac_search.Rd @@ -76,7 +76,7 @@ returned by these requests is a \code{stac_item_collection} object, a regular R \code{list} representing a STAC Item Collection document. } \examples{ -\dontrun{ +\donttest{ # GET request stac(url = "http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.1", force_version = "0.8.1") \%>\% diff --git a/tests/testthat/test-examples.R b/tests/testthat/test-examples.R index 05a248b6..d95f9a52 100644 --- a/tests/testthat/test-examples.R +++ b/tests/testthat/test-examples.R @@ -13,7 +13,7 @@ testthat::test_that("examples rstac", { force_version = "0.8.1") %>% rstac::collections() %>% rstac::get_request(), - class = "stac_collection_list") + class = "stac_catalog") # test collections items - /collections/{collection_id} testthat::expect_s3_class(