[R-sig-Geo] Error message in rgeos

Colin Rundel rundel at gmail.com
Thu Apr 7 23:39:26 CEST 2011

> I am getting the following error message when I try:
>> lineborder<-gBoundary(map1)
> Erro em TopologyFunc(spgeom, id, byid, "rgeos_boundary") :
>  IllegalArgumentException: Operation not supported by GeometryCollection
> map1 is a polygon created from a shape file.
> Also I get:
>> gIsSimple(map1)
> Erro em RGEOSUnaryPredFunc(spgeom, byid, "rgeos_issimple") :
>  IllegalArgumentException: This method does not support
> GeometryCollection arguments
>> gIsValid(map_outer_ring)
> [1] TRUE

For some reason when Rgeos is attempting to convert your sp object it is using a GeometryCollection type instead of a Polygon or Multipolygon type. Currently the GEOS library does not support GeometryCollection types with either gBoundary or gIsSimple and some of the other functions as well.

You can try both functions with byid=TRUE which will then run the GEOS function on each sub element of your sp object and will either return a single sp object or list of sp objects depending on the compatibility of the returned values.

If you can host the shapefile you are using somewhere and provide a link, I can look into why Rgeos is treating it as a GeometryCollection.


More information about the R-sig-Geo mailing list