Skip to content

Commit b7df7d6

Browse files
committed
adapt to boundary = NA to ignore the forced spatial filter discussed in #313
1 parent eb4b779 commit b7df7d6

File tree

5 files changed

+34
-23
lines changed

5 files changed

+34
-23
lines changed

R/get.R

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@
8787
#' if `quiet` is equal to `FALSE`, then vectortranslate operations will
8888
#' display a progress bar.
8989
#' @param boundary An `sf`/`sfc`/`bbox` object that will be used to create a
90-
#' spatial filter during the vectortranslate operations. The type of filter
91-
#' can be chosen using the argument `boundary_type`. If `place` is an `sf`/`sfc`
92-
#' polygon or a `bbox`, then it will be used as `boundary` if the latter is not
93-
#' specified.
90+
#' spatial filter during the vectortranslate operations. If you are running
91+
#' `oe_get()` and `place` is an `sf`/`sfc` polygon or a `bbox`, then it will
92+
#' be used as `boundary` if the latter is not specified. Set `boundary = NA`
93+
#' to override this behaviour and forcefully import the full extract.
9494
#' @param boundary_type A character vector of length 1 specifying the type of
9595
#' spatial filter. The `spat` filter selects only those features that
9696
#' intersect a given area, while `clipsrc` also clips the geometries. Check
@@ -264,11 +264,22 @@ oe_get = function(
264264
file_url = matched_zone[["url"]]
265265
file_size = matched_zone[["file_size"]]
266266

267-
# If place is an sf/sfc polygon or bbox, use it as boundary
268-
if (is.null(boundary) && (inherits(place, "bbox") || (inherits(place, c("sf", "sfc")) && sf::st_dimension(place) == 2))) {
269-
message("Setting boundary = place to geographically subset the output.")
270-
message("Use boundary = NULL to import full extract.")
271-
boundary = place
267+
# If place is an sf/sfc polygon or bbox, use it as boundary. See also #313 and
268+
# #314.The following !identical(x, NA) is required since is.na(NULL) returns
269+
# logical(0)
270+
if (!identical(boundary, NA)) {
271+
if (
272+
is.null(boundary) && (
273+
inherits(place, "bbox") ||
274+
(inherits(place, c("sf", "sfc")) && sf::st_dimension(place) == 2) # The last test checks for POLYGON / MULTIPOLYGON
275+
)
276+
) {
277+
oe_message(
278+
"Setting boundary = place to geographically subset the output. Use boundary = NA to import full extract.",
279+
quiet = quiet
280+
)
281+
boundary = place
282+
}
272283
}
273284

274285
oe_read(

R/vectortranslate.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,8 +536,8 @@ process_boundary = function(
536536
boundary = NULL,
537537
boundary_type = c("spat", "clipsrc")
538538
) {
539-
# Checks
540-
if (is.null(boundary)) {
539+
# Starting from #313, boundary might be NA on purpose
540+
if (is.na(boundary) || is.null(boundary)) {
541541
return(vectortranslate_options)
542542
}
543543

man/oe_get.Rd

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

man/oe_read.Rd

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

man/oe_vectortranslate.Rd

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

0 commit comments

Comments
 (0)