我根据我之前的帖子解决方案使用光栅包擦除功能来裁剪和溶解重叠多边形 -使用 R 中的差异和联合溶解重叠多边形
对于某些多边形,擦除功能出现以下错误:
RGEOSBinTopoFunc 中的错误(spgeom1,spgeom2,byid,id,drop_lower_td,unaryUnion_if_byid_false,:TopologyException:输入几何 1 无效:在点 1.1197332302192855 或附近的自相交点 1.1197332302192855 47.203098020153668 在 1.1197332302319268 09825.
library(raster)
library(rgeos)
library(sp)
fields <- gBuffer(fields, byid=TRUE, width=0) # Expands the given geometry to include
the area within the specified width
zone <- fields[fields$Type == "Zone", ]
plot <- fields[fields$Type == "Plot", ]
d <- erase(zone, plot) #issue here
spplot(d, "Rx")
# I tried using rgeos::gBuffer to avoid RGEOSBinTopology Exception but it did not worked out. Any guidance in this area would be really helpful.
zone <- gBuffer(zone, byid=TRUE, width=0)
plot <- gBuffer(plot, byid=TRUE, width=0)