rgpskernel-densityadehabitathr

How do I calculate the area of a Brownian bridge movement model?


In the adehabitatHR package there is some sample code to calculate Brownian bridge movement model for a wild boar using the kernelbb function. I would like to calculate the area of the object that results. I'd also like to know the units of the area. I think NTF (Paris) / Lambert zone III", EPSG code 27573, is the CRS.

Here's the code:

require(adehabitatHR)

data(puechcirc)
x <- puechcirc[1]
x

lik <- liker(x, sig2 = 58, rangesig1 = c(1, 10))

tata <- kernelbb(x, sig1 = 6.23, sig2 = 58, grid = 50)
tata

image(tata)
plot(getverticeshr(tata, 95), add=TRUE, lwd=2)

Solution

  • The function getverticeshr returns an object of class SpatialPolygonsDataFrame. You can use for example gArea from the rgeos package to calculate the area.

    library(rgeos)
    sp <- getverticeshr(tata, 95 )
    gArea(sp)
    ## [1] 1576647
    

    I assume that the units are m^2. To check the coordinate reference system (which was not set in this example) you would do: proj4string(sp).