开发者

gIntersects TopologyException in rgeos R

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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜