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

wkt_centroid

Extract Centroid


Description

get_centroid identifies the 2D centroid in a WKT object (or vector of WKT objects). Note that it assumes cartesian values.

Usage

wkt_centroid(wkt)

Arguments

wkt

a character vector of WKT objects, represented as strings

Value

a data.frame of two columns, lat and lng, with each row containing the centroid from the corresponding wkt object. In the case that the object is NA (or cannot be decoded) the resulting values will also be NA

See Also

wkt_coords() to extract all coordinates, and wkt_bounding() to extract a bounding box.

Examples

wkt_centroid("POLYGON((2 1.3,2.4 1.7))")

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.