Union one or more JamPolygon objects

union_JamPolygon(jp, new_name = NULL, verbose = FALSE, ...)

Arguments

jp

JamPolygon

new_name

character string to define optional names(jp) of the output. Otherwise it uses the first name in jp.

verbose

logical indicating whether to print verbose output.

...

additional arguments are ignored.

Value

JamPolygon after applying the union

Examples

df3 <- data.frame(name=c("polygon1", "polygon2"),
   label=c("polygon1", "polygon2"),
   x=I(list(
      list(c(1, 6, 6, 1),
         c(2, 5, 5, 2),
         c(3, 4, 4, 3)),
      list(#c(11, 16, 16, 11),
         c(12, 15, 15, 12),
         c(13, 14, 14, 13))
      )),
   y=I(list(
      list(c(1, 1, 6, 6),
         c(2, 2, 5, 5),
         c(3, 3, 4, 4)),
      list(#c(1, 1, 6, 6),
         c(2, 2, 5, 5),
         c(3, 3, 4, 4))
      )),
   fill=c("gold", "firebrick"))
jp3 <- new("JamPolygon", polygons=df3);
plot(jp3);


jp3b <- union_JamPolygon(jp3, new_name="polygons 1,2")
plot(jp3b)


# test empty polygon
jp3na <- jp3;
jp3na@polygons[2, "x"] <- I(list(NA))
jp3na@polygons[2, "y"] <- I(list(NA))
jp3na
#> An object of class "JamPolygon"
#> Slot "polygons":
#>       name    label            x            y      fill
#> 1 polygon1 polygon1 c(1, 6, .... c(1, 1, ....      gold
#> 2 polygon2 polygon2           NA           NA firebrick
#> 
union_JamPolygon(jp3na[1,])
#> An object of class "JamPolygon"
#> Slot "polygons":
#>       name    label            x            y fill
#> 1 polygon1 polygon1 c(1, 6, .... c(1, 1, .... gold
#> 
union_JamPolygon(jp3na)
#> An object of class "JamPolygon"
#> Slot "polygons":
#>       name    label            x            y fill
#> 1 polygon1 polygon1 c(1, 6, .... c(1, 1, .... gold
#>