lawn_tesselate: Tesselate

Description Usage Arguments Value See Also Examples

View source: R/tesselate.R

Description

Tesselates a data-Polygon into a data-FeatureCollection of triangles using earcut (github.com/mapbox/earcut)

Usage

1

Arguments

polygon

Input data-Feature<(data-Polygon)>

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

See Also

Other assertions: lawn_circle(), lawn_dissolve()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
poly <- '{
 "type": "Feature",
  "properties": {
    "fill": "#0f0"
  },
  "geometry": {
    "type": "Polygon",
    "coordinates": [[
      [-46.738586, -23.596711],
      [-46.738586, -23.458207],
      [-46.560058, -23.458207],
      [-46.560058, -23.596711],
      [-46.738586, -23.596711]
    ]]
  }
}'
lawn_tesselate(poly)

xx <- jsonlite::fromJSON(lawn_data$polygons_within, FALSE)
lawn_tesselate(xx$features[[1]])
## Not run: 
lawn_tesselate(xx$features[[1]]) %>% view
lawn_tesselate(poly) %>% view

## End(Not run)

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