Orient polygon coordinates

wk_orient(handleable, ..., direction = wk_counterclockwise())

wk_orient_filter(handler, direction = wk_counterclockwise())

wk_clockwise()

wk_counterclockwise()

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.

direction

The winding polygon winding direction

handler

A wk_handler object.

Value

handleable with consistently oriented polygons, in direction winding order.

Examples

wk_orient(wkt("POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))"))
#> <wk_wkt[1]>
#> [1] POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))
wk_orient(
  wkt("POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))"),
  direction = wk_clockwise()
)
#> <wk_wkt[1]>
#> [1] POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))