Learn R Programming

lawn (version 0.1.7)

lawn_merge: 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_erase, lawn_intersect, lawn_simplify, lawn_union

Examples

Run this code
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)

Run the code above in your browser using DataLab