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

wkt_correct

Correct Incorrectly Oriented WKT Objects


Description

wkt_correct does precisely what it says on the tin, correcting the orientation of WKT objects that are improperly oriented (say, back to front). It can be applied to WKT objects that, when validated with validate_wkt(), fail for that reason.

Usage

wkt_correct(x)

Arguments

x

a character vector of WKT objects to correct

Value

a character vector, the same length as x, containing either the original value (if there was no correction to make, or if the object was invalid for other reasons) or the corrected WKT value.

Examples

# A WKT object
wkt <- "POLYGON((30 20, 10 40, 45 40, 30 20), (15 5, 5 10, 10 20, 40 10, 15 5))"

# That's invalid due to a non-default orientation
validate_wkt(wkt)

# And suddenly isn't!
wkt_correct(wkt)

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.