Whereas a geo_bbox() of a geovctr is always of length 1, a geo_envelope() shares the same length as the vector. Both return a geo_rect(). Empty vectors (and empty geometries) return geo_rect(Inf, Inf, -Inf, -Inf), and NA/NaN values are removed if na.rm = TRUE (which might mean more Inf values than you expected).

geo_bbox(x, ..., na.rm = FALSE, finite = FALSE)

geo_x_range(x, ..., na.rm = FALSE, finite = FALSE)

geo_y_range(x, ..., na.rm = FALSE, finite = FALSE)

geo_envelope(x, ..., na.rm = FALSE, finite = FALSE)

geo_x_envelope(x, ..., na.rm = FALSE, finite = FALSE)

geo_y_envelope(x, ..., na.rm = FALSE, finite = FALSE)

Arguments

x

A geometry-like object, or one that can be coerced to a geometry-like object using as_geovctr().

...

Unused

na.rm

Should NAs be removed?

finite

Should only finite values be considered? TRUE implies na.rm = TRUE.

Value

geo_bbox() returns a geo_rect() of length 1, geo_envelope() returns a geo_rect() with the same length as x, geo_(x|y)_range() returns a geo_lim() of length 1, and geo_(x|y)_envelope() returns a geo_lim() with the same length as x.

Examples

geo_bbox(wkt(c("POINT (30 10)", "POINT EMPTY")))
#> <geovctrs_rect[1]> #> [1] (30 10...30 10)
geo_envelope(wkt(c("POINT (30 10)", "POINT EMPTY")))
#> <geovctrs_rect[2]> #> [1] (30 10...30 10) (Inf Inf...-Inf -Inf)