[R-sig-Geo] gUnion error -> TopologyException: side location conflict at...

Marc Marí Dell'Olmo marceivissa at gmail.com
Tue Oct 28 15:12:29 CET 2014


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)
[1] TRUE
> gIsValid(BCN.SC)
[1] TRUE
>
>
> 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



More information about the R-sig-Geo mailing list