Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: more guidance for big layers #170

Merged
merged 4 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ Config/testthat/edition: 3
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
SystemRequirements: C++11, GDAL (>= 2.0.1), GEOS (>= 3.4.0), PROJ (>=
4.8.0)
Remotes:
Remotes:
eblondel/ows4R
29 changes: 25 additions & 4 deletions R/layers.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
#' @param reduce_layers whether to reduce output layers to a single `sf` object.
#' @param ... additional vendor parameter arguments passed to
#' [`ows4R::GetFeature()`](https://docs.geoserver.org/stable/en/user/services/wfs/reference.html#getfeature).# nolint
#' For example, including `count=1` returns the first available feature.
#' For example, including `count = 1` returns the first available feature.
#' Or `outputFormat = "CSV"` (or `outputFormat = "JSON"`) might help downloading
#' bigger datasets.
#' @return If `reduce_layers = FALSE` (default), a list of `sf`
#' objects, one element for each layer. Any layers for which download was
#' unsuccessful will be NULL. If `reduce_layers = TRUE`, all layers are
Expand All @@ -37,8 +39,7 @@
#' an `sf` out of a single layer request instead of a list of length 1.
#' @export
#'
#' @examples
#' \dontrun{
#' @examplesIf interactive()
#' # Layers as character vector
#' emodnet_get_layers(
#' service = "biology",
Expand All @@ -58,7 +59,27 @@
#' layers = "mediseh_zostera_m_pnt",
#' count = 1
#' )
#' }
#'
#' # Usage of csv output
#' data <- emodnet_get_layers(
#' service = "biology_occurrence_data",
#' layers = "abiotic_observations",
#' outputFormat = "CSV"
#' )
#' str(data[["abiotic_observations"]])
#'
#' @section Big downloads:
#'
# nolint start: line_length_linter
#' If a layer is really big (like `"abiotic_observations"` of the
#' `"biology_occurrence_data"` service),
#' you might consider a combination of these ideas:
#' - using [`outputFormat = "CSV"`](https://docs.geoserver.org/stable/en/user/services/wfs/reference.html#getfeature);
#' - filtering using [`cql_filters`](https://emodnet.github.io/EMODnetWFS/articles/ecql_filtering.html) or
#' [bounding boxes](https://emodnet.github.io/EMODnetWFS/articles/request-params.html#limit-spatial-extent-using-a-boundary-box)
#' (possibly splitting the area of interests into several requests);
#' - Using [EMODnet's download toolbox](https://emodnet.ec.europa.eu/geoviewer/).
# nolint end
emodnet_get_layers <- function(wfs = NULL,
service = NULL,
service_version = NULL,
Expand Down Expand Up @@ -137,7 +158,7 @@
# if reduce_layers = T, reduce to single sf --------------------------------
if (reduce_layers) {
tryCatch(
out <- purrr::reduce(out, rbind),

Check warning on line 161 in R/layers.R

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=R/layers.R,line=161,col=7,[implicit_assignment_linter] Avoid implicit assignments in function calls. For example, instead of `if (x <- 1L) { ... }`, write `x <- 1L; if (x) { ... }`.
error = function(e) {
cli::cli_abort(
c(
Expand Down
31 changes: 28 additions & 3 deletions man/emodnet_get_layers.Rd

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

Loading