lawn_merge: Merge polygons

Description Usage Arguments Value See Also Examples

View source: R/merge.R

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

1
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

 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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)

Example output

<Polygon>
  Bounding box: 9.9 53.5 10.1 53.6
  No. points: 7
  Properties: 
     fill: #0f0

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