Currently, geovctrs supports X, Y, and Z coordinates. These functions extract, set, and drop Z values.

geo_set_z(x, z)

geo_drop_z(x)

geo_has_z(x)

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

geo_z_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().

z

A vector of z coordinate values.

...

Unused

na.rm

Should NAs be removed?

finite

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

Value

A modified version of x.

Examples

geo_set_z(c("POINT (2 3)", "POINT Z (2 3 4)"), 10)
#> <wk_wkt[2]> #> [1] POINT Z (2 3 10) POINT Z (2 3 10)
geo_drop_z(c("POINT (2 3)", "POINT Z (2 3 4)"))
#> <wk_wkt[2]> #> [1] POINT (2 3) POINT (2 3)
geo_has_z(c("POINT (2 3)", "POINT Z (2 3 4)"))
#> [1] FALSE TRUE
geo_z_range(c("POINT (2 3)", "POINT Z (2 3 4)"), na.rm = TRUE)
#> <geovctrs_lim[1]> #> [1] [4, 4]
geo_z_envelope(c("POINT (2 3)", "POINT Z (2 3 4)"), na.rm = TRUE)
#> <geovctrs_lim[2]> #> [1] [Inf, -Inf] [4, 4]