-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from OldLipe/master
Update version 0.3.3
- Loading branch information
Showing
52 changed files
with
2,801 additions
and
1,379 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,7 @@ | |
^codecov\.yml$ | ||
^appveyor\.yml$ | ||
^\.travis\.yml$ | ||
^\.httr-oauth$ | ||
^_pkgdown\.yml$ | ||
^docs$ | ||
^pkgdown$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* text=auto | ||
tests/fixtures/**/* -diff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,3 +38,5 @@ vignettes/*.pdf | |
# R Environment Variables | ||
.Renviron | ||
.Rproj.user | ||
docs | ||
inst/doc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,25 @@ | ||
Package: rstac | ||
Title: R Client Library for SpatioTemporal Asset Catalog | ||
Version: 0.1.4 | ||
Version: 0.3.3 | ||
Authors@R: | ||
c(person("Brazil Data Cube Team", email = "[email protected]", | ||
role = c("cph", "cre")), | ||
person("Rolf", "Simoes", email = "[email protected]", | ||
role = c("aut"), | ||
comment = c(ORCID = "0000-0003-0953-4132")), | ||
person("Felipe", "Carvalho", email = "[email protected]", role = c("aut"))) | ||
c(person("Brazil Data Cube Team", email = "[email protected]", | ||
role = c("cph", "cre", "aut"))) | ||
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 (<http://stacspec.org>). | ||
This package supports the version 0.8.0 of the STAC specification. | ||
This package supports the version 0.8.1 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 | ||
Encoding: UTF-8 | ||
LazyData: true | ||
RoxygenNote: 7.1.1 | ||
Depends: | ||
jsonlite, | ||
httr | ||
Suggests: | ||
httr, | ||
crayon | ||
Suggests: | ||
covr, | ||
magrittr, | ||
testthat, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,30 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
S3method(print,stac) | ||
S3method(print,stac_catalog) | ||
S3method(print,stac_collection) | ||
S3method(print,stac_item) | ||
S3method(print,stac_items) | ||
export(assets_download) | ||
export(collections) | ||
export(content_get_response) | ||
export(content_post_response) | ||
export(extension_query) | ||
export(get_request) | ||
export(items_assets) | ||
export(items) | ||
export(items_fetch) | ||
export(items_length) | ||
export(items_matched) | ||
export(params_get_request) | ||
export(params_post_request) | ||
export(post_request) | ||
export(stac) | ||
export(stac_collections) | ||
export(stac_items) | ||
export(stac_search) | ||
importFrom(crayon,bold) | ||
importFrom(httr,GET) | ||
importFrom(httr,POST) | ||
importFrom(httr,add_headers) | ||
importFrom(httr,content) | ||
importFrom(httr,http_type) | ||
importFrom(httr,status_code) | ||
importFrom(httr,write_disk) | ||
importFrom(jsonlite,fromJSON) | ||
importFrom(jsonlite,validate) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
#' @title Endpoint functions | ||
#' | ||
#' @rdname collections | ||
#' | ||
#' @description | ||
#' The \code{collections} function implements the WFS3 \code{/collections} | ||
#' and \code{/collections/\{collectionId\}} endpoints (v0.8.1). | ||
#' | ||
#' Each endpoint retrieves specific STAC objects: | ||
#' \itemize{ | ||
#' \item \code{/collections}: Returns a list of STAC Collection published in | ||
#' the STAC service | ||
#' \item \code{/collections/\{collectionId\}}: Returns a single STAC | ||
#' Collection object | ||
#' } | ||
#' | ||
#' @param s a \code{stac} object expressing a STAC search criteria | ||
#' provided by \code{stac}, \code{stac_search}, \code{stac_collections}, | ||
#' or \code{stac_items} functions. | ||
#' | ||
#' @param collection_id a \code{character} collection id to be retrieved. | ||
#' | ||
#' @seealso | ||
#' \code{\link{get_request}}, \code{\link{post_request}}, | ||
#' \code{\link{items}} | ||
#' | ||
#' @return | ||
#' A \code{stac} object containing all search field parameters to be provided | ||
#' to STAC API web service. | ||
#' | ||
#' @examples | ||
#' \dontrun{ | ||
#' | ||
#' stac("http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.0") %>% | ||
#' collections() %>% | ||
#' get_request() | ||
#' | ||
#' stac("http://brazildatacube.dpi.inpe.br/bdc-stac/0.8.0") %>% | ||
#' collections(collection_id = "MOD13Q1") %>% | ||
#' get_request() | ||
#' } | ||
|
||
#' @export | ||
collections <- function(s, collection_id) { | ||
|
||
# check s parameter | ||
if (!"collections" %in% class(s)) | ||
.check_obj(s, expected = "stac", exclusive = TRUE) | ||
|
||
params <- list() | ||
endpoint <- "/collections" | ||
if (!missing(collection_id)) { | ||
|
||
params[["collection_id"]] <- collection_id[[1]] | ||
endpoint <- paste("/collections", collection_id[[1]], sep = "/") | ||
} | ||
|
||
content <- .build_stac(url = s$url, | ||
endpoint = endpoint, | ||
params = params, | ||
subclass = "collections", | ||
base_stac = s) | ||
return(content) | ||
} | ||
|
||
params_get_request.collections <- function(s) { | ||
|
||
# ignore 'collection_id' param | ||
s$params[["collection_id"]] <- NULL | ||
|
||
# process stac params | ||
params <- params_get_request.stac(s) | ||
|
||
return(params) | ||
} | ||
|
||
params_post_request.collections <- function(s, enctype) { | ||
|
||
# ignore 'collection_id' param | ||
s$params[["collection_id"]] <- NULL | ||
|
||
# process stac params | ||
params <- params_post_request.stac(s, enctype = enctype) | ||
|
||
return(params) | ||
} | ||
|
||
content_get_response.collections <- function(s, res) { | ||
|
||
# detect expected response object class | ||
content_class <- "stac_catalog" | ||
|
||
if (!is.null(s$params[["collection_id"]])) | ||
content_class <- "stac_collection" | ||
|
||
content <- structure( | ||
.check_response(res, "200", "application/json"), | ||
stac = s, | ||
request = list(method = "get"), | ||
class = content_class) | ||
|
||
return(content) | ||
} | ||
|
||
content_post_response.collections <- function(s, res, enctype) { | ||
|
||
# detect expected response object class | ||
content_class <- "stac_catalog" | ||
|
||
if (!is.null(s$params[["collection_id"]])) | ||
content_class <- "stac_collection" | ||
|
||
content <- structure( | ||
.check_response(res, "200", "application/json"), | ||
stac = s, | ||
request = list(method = "post", enctype = enctype), | ||
class = content_class) | ||
|
||
return(content) | ||
} |
Oops, something went wrong.