Dear all,
I would like to join the polygons of two maps (with
SpatialPolygonsDataFrame format). I was trying to use gUnion funcition
(rgeos library) but I obtained the following error:
setwd("R:/CARTOGRAFIA/Barcelona")
BCN.SC<-readShapeSpatial("barcelona_SC2001.shp")
proj4string(BCN.SC) <- CRS("+proj=merc +datum=WGS84 +units=m")
BCN.SC<- spTransform(BCN.SC, CRS("+init=epsg:23031")) #ED50
BCN.CP<-readShapeSpatial("Dist_postals_BCN.shp") #ED50
proj4string(BCN.CP) <- CRS("+init=epsg:23031")
gIsValid(BCN.CP)
aux <- gUnion(BCN.SC,BCN.CP)
Error in RGEOSBinTopoFunc(spgeom1, spgeom2, byid, id, drop_lower_td,
"rgeos_union") :
TopologyException: side location conflict at 425106.60792063997
4583876.4374835696
I can't understand what's happening, glsValid is true for both shp
files. Moreover, I've made a zoom to this point and I can see anything
wrong.
Thank you for your help,
Marc