wk_format: Format well-known geometry for printing

View source: R/format.R

wk_formatR Documentation

Format well-known geometry for printing

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

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

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 Oct. 12, 2024, 1:07 a.m.