wk_vertices {wk}R Documentation

Extract vertices

Description

These functions provide ways to extract individual coordinate values. Whereas wk_vertices() returns a vector of coordinates as in the same format as the input, wk_coords() returns a data frame with coordinates as columns.

Usage

wk_vertices(handleable, ...)

wk_coords(handleable, ...)

wk_coords(handleable, use_z = NA, use_m = NA) <- value

wk_vertex_filter(handler, add_details = FALSE)

Arguments

handleable

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

...

Passed to the wk_handle() method.

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.

value

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

handler

A wk_handler object.

add_details

Use TRUE to add a "wk_details" attribute, which contains columns feature_id, part_id, and ring_id.

Details

⁠wk_coords<-⁠ is the replacement-function version of 'wk_coords'. Using the engine of wk_trans_explicit() the coordinates of an object can be transformed in a generic way using R functions as needed.

Value

Examples

wk_vertices(wkt("LINESTRING (0 0, 1 1)"))
wk_coords(wkt("LINESTRING (0 0, 1 1)"))

# wk_coords() replacement function
x <- xy(1:5, 1:5)
y <- as_wkt(x)
wk_coords(y) <- cbind(5:1, 0:4)
wk_coords(x) <- y[5:1]
y
x


[Package wk version 0.9.2 Index]