vendredi 23 janvier 2015

R Spatial: Trouble with gContains when polygon has holes


I have a shapefile which represents the areas of a city which have higher risks of flooding than others. This is a spatial polygon object however the polygon is disjoint and not connected. I also have a database of house locations in the city, and I want to develop a dummy variable to determine whether a house is located in any one of the disjointed parts of the polygon.


I've used the gContains(polygon, points) however I get the error



Error in RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
TopologyException: side location conflict at -9.2199117665562582 38.693948116552484


Which I imagine has to do with the fact that it is not one single polygon but multiple fractions of the same shapefile polygon spread out over the city. Unfortunately I'm not able to post a picture of the problem I'm having without more activity on this site (still just beginning with my research).


Maybe the gContains is not the best function to use, but I haven't been able to come across anything to help me out. Any leads would be appreciated! Happy to share the shapefiles and selection of the points database if that helps.


Thanks!





Aucun commentaire:

Enregistrer un commentaire