I add two circles and a polygon to the map flyer. Here is my code that describes these three forms. Is there a way to get the union of these three shapes?
leaflet(options = leafletOptions(minZoom = 0, maxZoom = 18))
m <- leaflet()%>%
addTiles()%>%
setView(72.84320,20.43397,zoom=16)%>%
addMouseCoordinates(style = "basic", epsg = NULL,
proj4string = NULL, native.crs = FALSE)
ARP <- c((72 +(50/60)+(32.67/3600)),(20+(26/60)+(1.54/3600)))
ptTop2 <- c((72 +(50/60)+(16.98/3600)),(20+(25/60)+(25.18/3600)))
ptBottom2 <- c((72 +(50/60)+(43.45/3600)),(20+(26/60)+(18.13/3600)))
ptTop1 <- c((72 +(50/60)+(8.64/3600)),(20+(26/60)+(8.08/3600)))
ptBottom1 <- c((72 +(50/60)+(44.21/3600)),(20+(26/60)+(5.63/3600)))
ap1 <- 95
ap2 <- 26
pt1 <- destPoint(ptTop1,ap1+90,4000)
pt2 <- destPoint(ptTop1,ap1-90,4000)
pt3 <- destPoint(ptBottom1,ap1-90,4000)
pt4 <- destPoint(ptBottom1,ap1+90,4000)
iRect <- data.frame(rbind(pt1,pt2,pt3,pt4))
m%>%addCircles(ptBottom1[1],ptBottom1[2],radius = 4000,color = "red",
fillOpacity = 0,weight = 3)%>%
addCircles(ptTop1[1],ptTop1[2],radius = 4000,color = "red",
fillOpacity = 0,weight = 3)%>%
addPolygons(iRect$lon,iRect$lat,color = "blue",
fillOpacity = 0, weight=3)
rgeoshas a function gUnion(), but I'm not sure how to convert the circles that were added by the above code to SpatialPolygons.