Handler interface for grid objects

# S3 method for class 'wk_grd_xy'
wk_handle(handleable, handler, ..., data_order = c("y", "x"))

# S3 method for class 'wk_grd_rct'
wk_handle(handleable, handler, ..., data_order = c("y", "x"))

Arguments

handleable

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

handler

A wk_handler object.

...

Passed to the wk_handle() method.

data_order

A vector of length 2 describing the order in which values should appear. The default, c("y", "x"), will output values in the same order as the default matrix storage in R (column-major). You can prefix a dimension with - to reverse the order of a dimension (e.g., c("-y", "x")).

Value

The result of the handler.

Examples

wk_handle(grd(nx = 3, ny = 3), wkt_writer())
#> <wk_wkt[9]>
#> [1] POLYGON ((0 2, 1 2, 1 3, 0 3, 0 2)) POLYGON ((0 1, 1 1, 1 2, 0 2, 0 1))
#> [3] POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)) POLYGON ((1 2, 2 2, 2 3, 1 3, 1 2))
#> [5] POLYGON ((1 1, 2 1, 2 2, 1 2, 1 1)) POLYGON ((1 0, 2 0, 2 1, 1 1, 1 0))
#> [7] POLYGON ((2 2, 3 2, 3 3, 2 3, 2 2)) POLYGON ((2 1, 3 1, 3 2, 2 2, 2 1))
#> [9] POLYGON ((2 0, 3 0, 3 1, 2 1, 2 0))
wk_handle(grd(nx = 3, ny = 3, type = "centers"), wkt_writer())
#> <wk_wkt[9]>
#> [1] POINT (0.5 2.5) POINT (0.5 1.5) POINT (0.5 0.5) POINT (1.5 2.5)
#> [5] POINT (1.5 1.5) POINT (1.5 0.5) POINT (2.5 2.5) POINT (2.5 1.5)
#> [9] POINT (2.5 0.5)