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

Kenneth Takagi katakagi at bu.edu
Mon Jun 7 02:18:59 CEST 2010


Michael,

I figured out the issue with unionSpatialPolygons() (I posted this on 
R-sig-Geo as well):

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()  # downloaded package "gpclib" to run this function
General Polygon Clipper Library for R (version 1.5-1)
     Type 'class ? gpc.poly' for help

[1] TRUE

Then unionSpatialPolygons() works fine.  As for the issue with 
installing package "rgeos", I'm not sure of the issue, but I posted on 
r-sig-geo the error, so hopefully they are aware of it now.

Ken

On 06/06/2010 07:55 PM, Michael Rutter wrote:
>
>
> On 06/05/2010 07:28 PM, 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:
>>
>> # 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
>>
>> 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
>
> Ken,
>
> Without a "foo.shp" file to use as an example, I can't recreate your
> original R error. Can you redo the example given on page 57 of the
> maptools pdf manual?
>
> However, I can recreate the error when trying to install rgeos. That
> error needs to be addressed with the rgeos developers, as it appears
> that is an error in their code, not something that is missing in R or in
> Ubuntu.
>
> Hope this helps,
> Michael
>



More information about the R-SIG-Debian mailing list