lawn_union: Merge polygons

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/union.R

Description

Finds the intersection of two data-Polygon's and returns the union of the two

Usage

1
lawn_union(poly1, poly2, lint = FALSE)

Arguments

poly1

A data-Feature<(data-Polygon)>

poly2

A 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

Details

Contiguous polygons are combined, non-contiguous polygons are returned as MultiPolygon.

Value

data-Feature<(data-Polygon)> or data-Feature<(data-MultiPolygon)>

Author(s)

Jeff Hollister hollister.jeff@epa.gov

See Also

lawn_merge

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

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
41
42
43
44
45
46
47
48
49
50
51
## Not run: 
poly1 <- '{
 "type": "Feature",
 "properties": {
   "fill": "#0f0"
 },
 "geometry": {
   "type": "Polygon",
   "coordinates": [[
     [-122.801742, 45.48565],
     [-122.801742, 45.60491],
     [-122.584762, 45.60491],
     [-122.584762, 45.48565],
     [-122.801742, 45.48565]
    ]]
 }
}'

poly2 <- '{
 "type": "Feature",
 "properties": {
   "fill": "#00f"
 },
 "geometry": {
   "type": "Polygon",
   "coordinates": [[
     [-122.520217, 45.535693],
     [-122.64038, 45.553967],
     [-122.720031, 45.526554],
     [-122.669906, 45.507309],
     [-122.723464, 45.446643],
     [-122.532577, 45.408574],
     [-122.487258, 45.477466],
     [-122.520217, 45.535693]
     ]]
 }
}'
lawn_union(poly1, poly2)

view(poly1)
view(poly2)
lawn_union(poly1, poly2) %>% view()

x1 <- lawn_buffer(lawn_point(c(-122.6375, 45.53)), 1500, "meters")
x2 <- lawn_buffer(lawn_point(c(-122.6475, 45.53)), 1500, "meters")
lawn_union(x1, x2)
view(x1)
view(x2)
lawn_union(x1, x2) %>% view()

## End(Not run)

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