lawn_rewind: Rewind

View source: R/rewind.R

lawn_rewindR Documentation

Rewind

Description

Rewind (Multi)LineString or (Multi)Polygon outer ring counterclockwise and inner rings clockwise (Uses Shoelace Formula)

Usage

lawn_rewind(x, reverse = FALSE, mutate = FALSE, lint = FALSE)

Arguments

x

A data-FeatureCollection or data-Feature with Polygon, MultiPolygon, LineString, or MultiLineString

reverse

(logical) enable reverse winding. Default: FALSE

mutate

(logical) allows GeoJSON input to be mutated (significant performance increase if true) Default: FALSE

lint

(logical) Lint or not. Uses geojsonhint. Takes up increasing time as the object to get linted increases in size, so probably use by default for small objects, but not for large if you know they are good geojson objects. Default: FALSE

Value

A data-FeatureCollection

Examples

x <- '{
"type": "Feature",
"properties": {},
"geometry": {
  "type": "Polygon",
  "coordinates": [
    [[121, -29], [138, -29], [138, -18], [121, -18], [121, -29]]
   ]
  }
}'
lawn_rewind(x, TRUE)
lawn_rewind(x, mutate = TRUE)
lawn_rewind(x, lint = TRUE)

ropensci/lawn documentation built on May 18, 2022, 9:58 a.m.