Having trouble calculating Home Range area

2k Views Asked by At

I am having a lot of trouble in R calculating the area of home range of an animal. I thought once I produced a home range (if I've done it correctly) calculating the area would be easy, but no

I've pasted some of the code I've been trying. I wonder would anyone have any insight?

# Load package

    library(adehabitat)

#Load file Frodo

    dd <- read.csv(file.choose(), header = T)

# Plot the home range

    xy <- dd[,c("X","Y")]
    id <- dd[,"name"]
    hr<- mcp(xy,id,percent=95)
    plot(hr)
    points(xy[xy$id=="frodo",])

#Great. Home range produced.  Now calculate area

    area <- mcp.area(xy, id,percent = 95),

# Result 2.287789e-09 Ha.  Way to small.  Maybe it doesnt like Lat / Long.  

# Will try and convert coordinates  into M or Km

# Load map project

    library(mapproj)

    x<-mapproject(t$X,t$Y,projection="mercator")

# Its converted it to something but its not M's  or Km's.  
# I'll try and run it anyway

    xy <- x[,c("X","Y")]

# incorrect number of dimensions

# Ill try Project 4
library(proj4)

    xy <- dd[,c("X","Y")]
    tr <- ptransform(xy/180*pi, '+proj=latlong +ellps=sphere',
                 '+proj=merc +ellps=sphere')
    View(tr)

# There seems to be a Z column filled with 0's. 
# It that going to affect anything? 
# Let's look at the data
    plot(tr)

# Looks good, Lets try and create a home range

    xy <- tr[,c("x","y")]
#  'incorrect number of dimensions'

No idea what the problem is. Don't know if I'm on the right track or doing something completely wrong

1

There are 1 best solutions below

2
On

In order to calculate area you need your points in a projected coordinate systems (area in long/lat would just be units of degree). The type of projection you use is going to have a big effect on the resulting area. For instance the Mercator projection distorts area away from the Equator -- you might want to look into the best equal-area projection for your location. I am going to answer the programming part of your question, once you find the right projections to use you can substitute them in.

require(sp)
require(rgdal)
orig.points <- dd[,c("X","Y")]

# geographic coordinate system of your points
c1 <- CRS("+proj=latlong +ellps=sphere") 

# define as SpatialPoints
p1 <- SpatialPoints(orig.points, proj4string=c1) 

# define projected coordinate system of your choice, I am using the one you 
# defined above, but see:     
# http://www.remotesensing.org/geotiff/proj_list/mercator_1sp.html
# to make sure your definition of the mercator projection is appropriate
c2 <- CRS("+proj=merc ellps=sphere")

p2 <- spTransform(p1, c2) # project points
# convert to Polygon (this automatically computes the area as an attribute)
poly <- Polygon(p2)
poly@area #will print out the area