wk_format: Format well-known geometry for printing

Description Usage Arguments Value Examples

View source: R/format.R

Description

Provides an abbreviated version of the well-known text representation of a geometry. This returns a constant number of coordinates for each geometry, so is safe to use for geometry vectors with many (potentially large) features. Parse errors are passed on to the format string and do not cause this handler to error.

Usage

1
2
3
wk_format(handleable, precision = 7, trim = TRUE, max_coords = 6, ...)

wkt_format_handler(precision = 7, trim = TRUE, max_coords = 6)

Arguments

handleable

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

precision

If trim is TRUE, the total number of significant digits to keep for each result or the number of digits after the decimal place otherwise.

trim

Use FALSE to keep trailing zeroes after the decimal place.

max_coords

The maximum number of coordinates to include in the output.

...

Passed to the wk_handle() method.

Value

A character vector of abbreviated well-known text.

Examples

1
2
3
4
5
6
wk_format(wkt("MULTIPOLYGON (((0 0, 10 0, 0 10, 0 0)))"))
wk_format(new_wk_wkt("POINT ENTPY"))
wk_handle(
  wkt("MULTIPOLYGON (((0 0, 10 0, 0 10, 0 0)))"),
  wkt_format_handler()
)

wk documentation built on March 16, 2021, 5:11 p.m.