lawn_tesselate: Tesselate

View source: R/tesselate.R

lawn_tesselateR Documentation

Tesselate

Description

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

Usage

lawn_tesselate(polygon, lint = FALSE)

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

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)

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