wkt_grob: Generate grid geometries from well-known geometries

View source: R/grob.R

wkt_grobR Documentation

Generate grid geometries from well-known geometries

Description

Using wkt_meta() and wkt_coords(), these functions create graphical objects using the grid package. Vectors that contain geometries of a single dimension are efficiently packed into a grid::pointsGrob(), grid::polylineGrob(), or grid::pathGrob(). Vectors with mixed types and nested collections are encoded less efficiently using a grid::gTree().

Usage

wkt_grob(
  wkt,
  ...,
  rule = "evenodd",
  default.units = "native",
  name = NULL,
  vp = NULL
)

wkb_grob(
  wkt,
  ...,
  rule = "evenodd",
  default.units = "native",
  name = NULL,
  vp = NULL
)

Arguments

wkt

A character vector containing well-known text.

...

Graphical parameters passed to grid::gpar(). These are recycled along the input. Dynamic dots (e.g., !!!) are supported.

rule

Use "winding" if polygon rings are correctly encoded with a winding direction.

default.units

Coordinate units, which may be defined by the viewport (see grid::unit()). Defaults to native.

name, vp

Passed to grid::pointsGrob(), grid::polylineGrob(), grid::pathGrob(), or grid::gTree() depending on the types of geometries in the input.

Value

A graphical object

Examples

grid::grid.newpage()
grid::grid.draw(wkt_grob("POINT (0.5 0.5)", pch = 16, default.units = "npc"))


paleolimbot/wkutils documentation built on Feb. 5, 2023, 10:42 a.m.