[R-sig-Geo] Problems loading hydrosanity package

Felix Andrews felix at nfrac.org
Fri May 29 01:43:14 CEST 2009


2009/5/29 Roger Bivand <Roger.Bivand at nhh.no>:
> On Thu, 28 May 2009, BRWIN338 at aol.com wrote:
>
>> Good Morning:
>>
>> I need to construct a set of Thiessen Polygons centered around
>> approximately 4500 longlat positions in the US.  After searching the R site,
>> I was going to attempt to use the arealsubPolygons function in the
>> hydrosanity package.  I am using a Windows system.
>>
>> When attempting to call the package I get the following error messages
>> under both R2.8.1 and R2.9.0.
>> ##################################################################
>>>
>>> require(hydrosanity)
>>
>> Loading required package:  hydrosanity
>> Loading required package: playwith
>> Loading required package:  lattice
>> Loading required package: cairoDevice
>> Error in inDL(x,  as.logical(local), as.logical(now), ...) :
>> unable to load shared  library
>> 'C:/PROGRA~1/R/R-28~1.1/library/cairoDevice/libs/cairoDevice.dll':
>> LoadLibrary failure:  The specified module could not be found.
>>
>>
>> Error: package 'cairoDevice' could not be  loaded
>> ###################################################################
>> I have tried downloading the package and it's dependencies from  several
>> locations and get the same errors each time.
>>
>> Any suggestions with respect to this package or others that I might  use
>> to
>> construct my polygons would be appreciated.  I need a set  of polygons
>> that
>> cover the entire US county polygon.
>
> The package description does say that it is "under development and should
> not be considered stable", seems honest. Look at the code in its URL:
>
> http://code.google.com/p/hydrosanity/source/browse/trunk/R/spatial_functions.R
>
> find the function and its dependencies, load sp first, and probably a matrix
> of boundary coordinates for a representation that has a coercion method to
> gpc.poly, your point matrix, a vector of IDs, and source the function
> locally. That avoids resolving all the dependencies needed for the GUI in
> the package, and ought to work. Watch the min.area.pct= argument as small
> polygons may go away.
>
> Should work with some tweaking.

I tried

library(sp)
library(tripack)
library(gpclib)
foo <- arealSubPolygons(state.center, IDs = state.name)
class(foo)
[1] "SpatialPolygons"

But I can't seem to plot the result...
spplot(foo)
Error in function (classes, fdef, mtable)  :
  unable to find an inherited method for function "spplot", for
signature "SpatialPolygons"

Note also that you can construct Thiessen / Voronoi Polygons for
plotting with the tileplot function in latticeExtra:

library(latticeExtra)
tileplot(x ~ x * y, state.center, border = "black", points=FALSE)

See the code for panel.voronoi for how it is done
(it has two implementations, based on either tripack or deldir).


Hope that helps
-Felix


-- 
Felix Andrews / 安福立
Post-Doctoral Fellow
Integrated Catchment Assessment and Management (iCAM) Centre
Fenner School of Environment and Society [Bldg 48a]
The Australian National University
Canberra ACT 0200 Australia
M: +61 410 400 963
T: + 61 2 6125 1670
E: felix.andrews at anu.edu.au
CRICOS Provider No. 00120C
-- 
http://www.neurofractal.org/felix/



More information about the R-sig-Geo mailing list