[R-sig-Geo] Issues with unionSpatialPolygons on Ubuntu

Kenneth Takagi katakagi at bu.edu
Sun Jun 6 22:56:03 CEST 2010


Thanks for the info,

Turns out that that I didn't have package "gpclib" installed.  Once 
installed, I could run the gpclibPermit() function, which set 
gpclibPermitStatus() = T:

> library(maptools)
Loading required package: foreign
Loading required package: sp
Loading required package: lattice

	Note: polygon geometry computations in maptools
  	depend on the package gpclib, which has a
  	restricted licence. It is disabled by default;
  	to enable gpclib, type gpclibPermit()

Checking rgeos availability as gpclib substitute:
FALSE

> gpclibPermit()
General Polygon Clipper Library for R (version 1.5-1)
	Type 'class ? gpc.poly' for help

[1] TRUE

> # Read in shapefile and merge polygons
> foo <- readShapePoly("foo.shp", proj4string = CRS("+init=epsg:2272"))
> IDs <- as.character(foo$ID)
> SP_out <- unionSpatialPolygons(foo, IDs)

And everything worked fine.  Not sure if there is another way, but this 
worked for me!

Ken

Quoting Roger Bivand <Roger.Bivand at nhh.no>:

> On Sat, 5 Jun 2010, Kenneth Takagi wrote:
>
>>
>> Hi,
>>
>> I've cross posted with r-sig-debian since they may be an issue for 
>> linux (never had this problem on my windows machine...) I recently 
>> made the switch to Ubuntu 10.04 (lucid), and found that 
>> unionSpatialPolygons() gives me the following error when trying to 
>> combine polygons within a shapefile:
>
> Did you check that the package versions on Linux and Windows were the same
> (they were not, hence the difference)?
>
>>
>> # Read in shapefile and merge polygons
>> foo <- readShapePoly("foo.shp", proj4string = CRS("+init=epsg:2272"))
>> IDs <- as.character(foo$ID)
>> SP_out <- unionSpatialPolygons(foo, IDs)
>> Error: isTRUE(gpclibPermitStatus()) is not TRUE
>>
>
> Googling on "R gpclibPermit" takes you to the explanation (second hit),
> with the posting on this list's archives at:
>
> https://stat.ethz.ch/pipermail/r-sig-geo/2010-May/008206.html
>
> So set gpclibPermit() to TRUE to use gpclib, or try again to install
> rgeos (which has an external dependency), which is work in progress, so
> may not install cleanly when lots of changes are in progress (which is
> the case at the moment).
>
> Hope this helps,
>
> Roger
>
>> I've seen some posts about a package "rgeos" which may have 
>> something to do with this
>> error, and I downloaded the source from:
>> http://r-forge.r-project.org/R/?group_id=602
>>
>> But when I've tried to install by source using R CMD INSTALL (or using
>> install.packages()) I get the following error message:
>>
>> ...lines of output not shown...
>> rgeos_misc.c: In function ?rgeos_hausdorffdistance?:
>> rgeos_misc.c:62: error: ?GEOSHausdorffDistance_r? undeclared (first 
>> use in this function)
>> rgeos_misc.c:62: error: (Each undeclared identifier is reported only once
>> rgeos_misc.c:62: error: for each function it appears in.)
>> make: *** [rgeos_misc.o] Error 1
>> ERROR: compilation failed for package ?rgeos?
>>
>> I'm using R version 2.11.1 (2010-05-31), in ubuntu 10.04 LTS
>>
>> Thanks for any help you can offer on getting unionSpatialPolygon up 
>> and running!
>>
>> Ken
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
> -- 
> Roger Bivand
> Economic Geography Section, Department of Economics, Norwegian School of
> Economics and Business Administration, Helleveien 30, N-5045 Bergen,
> Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
> e-mail: Roger.Bivand at nhh.no
>
>
>



More information about the R-sig-Geo mailing list