Set coordinate values

wk_set_z(handleable, z, ...)

wk_set_m(handleable, m, ...)

wk_drop_z(handleable, ...)

wk_drop_m(handleable, ...)

wk_trans_set(value, use_z = NA, use_m = NA)

Arguments

handleable

A geometry vector (e.g., wkb(), wkt(), xy(), rct(), or sf::st_sfc()) for which wk_handle() is defined.

z, m

A vector of Z or M values applied feature-wise and recycled along handleable. Use NA to keep the existing value of a given feature.

...

Passed to the wk_handle() method.

value

An xy(), xyz(), xym(), or xyzm() of coordinates used to replace values in the input. Use NA to keep the existing value.

use_z, use_m

Used to declare the output type. Use TRUE to ensure the output has that dimension, FALSE to ensure it does not, and NA to leave the dimension unchanged.

Examples

wk_set_z(wkt("POINT (0 1)"), 2)
#> <wk_wkt[1]> #> [1] POINT Z (0 1 2)
wk_set_m(wkt("POINT (0 1)"), 2)
#> <wk_wkt[1]> #> [1] POINT M (0 1 2)
wk_drop_z(wkt("POINT ZM (0 1 2 3)"))
#> <wk_wkt[1]> #> [1] POINT M (0 1 3)
wk_drop_m(wkt("POINT ZM (0 1 2 3)"))
#> <wk_wkt[1]> #> [1] POINT Z (0 1 2)