Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

wkt_bounding

Convert WKT Objects into Bounding Boxes


Description

wkt_bounding turns WKT objects (specifically points, linestrings, polygons, and multi-points/linestrings/polygons) into bounding boxes.

Usage

wkt_bounding(wkt, as_matrix = FALSE)

Arguments

wkt

a character vector of WKT objects.

as_matrix

whether to return the results as a matrix (TRUE) or data.frame (FALSE). Set to FALSE by default.

Value

either a data.frame or matrix, depending on the value of as_matrix, containing four columns - min_x, min_y, max_x and max_y - representing the various points of the bounding box. In the event that a valid bounding box cannot be generated (due to the invalidity or incompatibility of the WKT object), NAs will be returned.

See Also

bounding_wkt(), to turn R-size bounding boxes into WKT objects

Examples

wkt_bounding("POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))")

wellknown

Convert Between 'WKT' and 'GeoJSON'

v0.7.2
MIT + file LICENSE
Authors
Scott Chamberlain [aut, cre] (<https://orcid.org/0000-0003-1444-9135>), Os Keyes [aut] (author of code in src/)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.