rgeos R 中的 gIntersects TopologyException

发布于 2024-12-05 14:13:12 字数 1302 浏览 6 评论 0原文

我有一个代表世界生态区域的形状文件。我试图确定哪些生态区与我感兴趣的物种的分布相交。我正在使用最新版本的 R 以及 rgdal 和 rgeos 软件包。

我加载了一个名为“rangelist”的物种范围列表。

我加载我的生态区域形状文件(eco),并创建一个名为“regions”的列表,其中包含每个生态区域的 SpatialPolygonsDataFrame 对象:

readOGR(ecofile,gsub(".shp","",ecofile))->eco
regions<-list()
for (i in 1:length(unique(eco$ECO_NAME))){
    print(unique(eco$ECO_NAME)[i])
    eco[eco$ECO_NAME==unique(eco$ECO_NAME)[i],]->regions[[i]]
}
names(regions)<-as.character(unique(eco$ECO_NAME))

然后运行一个循环函数,根据“regions”中的每个生态区域检查“rangelist”中的每个范围'。这工作正常,直到:

> gIntersects(rangelist[[49]],regions[[23]])
Error in RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) : 
  TopologyException: side location conflict at -78.7709 -8.18245

我将原始生态区域形状文件加载到 arcMap 10 中并运行“检查几何”工具,但没有发现任何问题。

数据的原始来源是: 物种范围: http://www.natureserve.org/getData/birdMaps.jsp 生态区: http://www.worldwildlife.org/science/data/item1875.html

我暂时在此处发布了一个 zip 文件,其中包含2 个 Rdata 文件和一个 R 脚本,可让您重现错误(文件大小为 33mb)。

有谁知道我如何解决或解决这个问题?

I have a shapefile that represents ecoregions of the world. I am trying to determine which ecoregions are intersected by the distributions of my species of interest. I am using the latest version of R and the rgdal and rgeos packages.

I load in a list of species ranges called 'rangelist'.

I load in my ecoregions shapefile (eco), and create a list called 'regions', which contains a SpatialPolygonsDataFrame object for every ecoregion:

readOGR(ecofile,gsub(".shp","",ecofile))->eco
regions<-list()
for (i in 1:length(unique(eco$ECO_NAME))){
    print(unique(eco$ECO_NAME)[i])
    eco[eco$ECO_NAME==unique(eco$ECO_NAME)[i],]->regions[[i]]
}
names(regions)<-as.character(unique(eco$ECO_NAME))

I then run a loop function that checks each range from 'rangelist' against each of these ecoregions from 'regions'. This works fine until:

> gIntersects(rangelist[[49]],regions[[23]])
Error in RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) : 
  TopologyException: side location conflict at -78.7709 -8.18245

I loaded the original ecoregions shapefile into arcMap 10 and ran the "check geometry" tool but it found no problems.

The original sources of the data are:
species ranges:
http://www.natureserve.org/getData/birdMaps.jsp
ecoregions:
http://www.worldwildlife.org/science/data/item1875.html

I have temporarily posted here a zip file containing 2 Rdata files and an R script to allow you to reproduce the error (file size is 33mb).

Does anyone have any idea as to how I can fix or get around this problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文