# NOT RUN {
e1 <- ext(-10, 10, -20, 20)
e2 <- ext(0, 20, -40, 5)
union(e1, e2)
#SpatVector
#v <- vect(system.file("ex/lux.shp", package="terra"))
#v <- v[,3:4]
#p <- vect(c("POLYGON ((5.8 49.8, 6 49.9, 6.15 49.8, 6 49.65, 5.8 49.8))",
#"POLYGON ((6.3 49.9, 6.2 49.7, 6.3 49.6, 6.5 49.8, 6.3 49.9))"), crs=crs(v))
#values(p) <- data.frame(pid=1:2, area=area(p))
#u <- union(v, p)
#plot(u, "pid")
# }
Run the code above in your browser using DataLab