lawn_merge: Merge polygons

View source: R/merge.R

lawn_mergeR Documentation

Merge polygons

Description

Takes a set of data-Polygon's and returns a single merged polygon feature. If the input polygon features are not contiguous, returns a data-MultiPolygon feature.

Usage

lawn_merge(fc, lint = FALSE)

Arguments

fc

Input polygons, as data-FeatureCollection.

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

Merged data-Polygon or multipolygon data-MultiPolygon.

See Also

lawn_union

Other transformations: lawn_bezier(), lawn_buffer(), lawn_concave(), lawn_convex(), lawn_difference(), lawn_intersect(), lawn_simplify(), lawn_union()

Examples

polygons <- '{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "fill": "#0f0"
      },
      "geometry": {
        "type": "Polygon",
        "coordinates": [[
          [9.994812, 53.549487],
          [10.046997, 53.598209],
          [10.117721, 53.531737],
          [9.994812, 53.549487]
        ]]
      }
    }, {
      "type": "Feature",
      "properties": {
        "fill": "#00f"
      },
      "geometry": {
        "type": "Polygon",
        "coordinates": [[
          [10.000991, 53.50418],
          [10.03807, 53.562539],
          [9.926834, 53.551731],
          [10.000991, 53.50418]
        ]]
      }
    }
  ]
}'
lawn_merge(polygons)
## Not run: 
lawn_featurecollection(polygons) %>% view
lawn_merge(polygons) %>% view

## End(Not run)

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