lawn_rewind: Rewind

Description Usage Arguments Value Examples

View source: R/rewind.R

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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)

Example output

<FeatureCollection>
  Bounding box: 121.0 -29.0 138.0 -18.0
  No. features: 0
  No. points: 0
  Properties: NULL
<FeatureCollection>
  Bounding box: 121.0 -29.0 138.0 -18.0
  No. features: 0
  No. points: 0
  Properties: NULL
<FeatureCollection>
  Bounding box: 121.0 -29.0 138.0 -18.0
  No. features: 0
  No. points: 0
  Properties: NULL

lawn documentation built on Jan. 6, 2021, 5:07 p.m.