【发布时间】:2020-03-15 22:02:57
【问题描述】:
根据我之前的帖子解决方案,我正在使用光栅包擦除功能来裁剪和溶解重叠的多边形 - Dissolve Overlapping Polygons using difference and union in R
对于某些多边形,我使用擦除功能遇到错误:
RGEOSBinTopoFunc 中的错误(spgeom1,spgeom2,byid,id,drop_lower_td,unaryUnion_if_byid_false,: TopologyException:输入几何 1 无效:在点 1.1197332302192855 47.203098020153668 处或附近自交点 1.1197332302192855 47.203098020153668
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)
【问题讨论】:
-
错误信息很清楚。绘制该位置的图。然后修复它...如果您不知道使用,
crop仅选择该区域以便您可以共享数据。 -
感谢 Robert 的回复...。您可以从这里下载测试 shapefile - filedropper.com/trialmap1
-
@RobertHijmans 你有没有机会研究同样的问题......任何可能的解决方案......
-
我无权访问该文件。最好不要使用文件,而是将数据作为代码共享(参见例如
geom)。但如果这太难了,也许使用谷歌驱动器? Filedropper 对我不起作用 --- 只是广告
标签: r raster r-raster rgeo-shapefile