[R-sig-Geo] converting home range contours in 'adehabitat' to polygons

Mathieu Basille basille at ase-research.org
Thu Sep 2 16:06:33 CEST 2010


Tom,

Did you have a look at 'area2spol'?

 From the example of 'kernelUD':

data(puechabon)
loc <- puechabon$locs[, c("X", "Y")]
id <- puechabon$locs[, "Name"]
(ud <- kernelUD(loc, id))
ver <- getverticeshr(ud, 95)

Then, you can do something like that:

spver <- lapply(ver, area2spol)

Which returns a list of SpatialPolygons (sp):

class(spver[[1]])
[1] "SpatialPolygons"
attr(,"package")
[1] "sp"

I don't really know spatstat but there might be some conversion tools 
between sp and spatsat.

Hope this helps,
Mathieu.


Le 02/09/2010 05:58, Tom_R a écrit :
>
> Hi List,
>   I am trying to calculate the  area of overlap amongst a list of animal home
> ranges; ten ants each, from five colonies. The help page for kernelUD
> {adehabitat} states, " getverticeshr stores the home range contour as
> objects of class area in a list of class kver, with one component per
> animal."  [the 'components' are of class 'area'] .
> However, I am having difficulties converting the list (class  'kver') of
> home ranges (class 'area') to a list of polygons that can be manipulated
> with spatstat.
>
>
>          xy<-  data.frame(cbind(x[colony==i&  ant==j],  y[colony==i&
> ant==j]))
> 	who<- as.factor(ant[colony==i&  ant==j])
> 	ud<-  kernelUD(xy, who, h = "href",  same4all = TRUE)
> 	ver<- getverticeshr(ud, 50)
>          class(ver)
>> [1] "kver"
>
>
> After converting the 'ver' list to polygons,  I would convert to owin
> objects (in the spatstat package) and then use the functions intersect.owin
> and area.owin to find the area of the overlap.
>
> In summary:
> 1) How to convert a list of class kver, with one area object per animal?
>
> Many thanks in advance!!
> Tom Richardson
>
>
>
>

-- 

~$ whoami
Mathieu Basille, Post-Doc

~$ locate
Laboratoire d'Écologie Comportementale et de Conservation de la Faune
+ Centre d'Étude de la Forêt
Département de Biologie
Université Laval, Québec

~$ info
http://ase-research.org/basille

~$ fortune
``If you can't win by reason, go for volume.''
Calvin, by Bill Watterson.



More information about the R-sig-Geo mailing list