[AniMov] Exporting kde to Esri shapefile

Yvan Satge ysatge at clemson.edu
Wed Oct 16 19:39:14 CEST 2013


Hello all,

I am working on a set of bird locations from which I have calculated a
kernel density estimate using kde (package: ks). I use kde because I can
use the Plug-In bandwith calculation (see script below), which gives me
good results.

I would like to know if it is possible to export the 50% and 95% contours
to an Esri shapefile.

I know that it is possible to do so using kernelUD (package: adehabitat):
Corrie Curtice and Mathias Tobler gave an explanation in this same mailing
list (http://www.mail-archive.com/animov@faunalia.it/msg00115.html).

-> Does any one of you know if there is a way to do something similar with
kde ?

Thanks,
Yvan


Library(ks)

bird1<- data.frame(read.table(file='C:/bird1csv',sep=',',header=TRUE,))

# Setting bandwidth to PI (Plug-In)
H <- Hpi(x=bird1)
# Running Kernel Density Estimator based on bandwidth = H
fhat <- kde(x=bird1, H=H)
 # Plotting with 25,50,75% contours
plot(fhat, display='filled.contour2', main = 'Plug-in', cont = c(50,90))
points (bird1, cex=0.5, pch=16)



######
#  Adapted from Corrie Curtice's script (see link above)

Library(adehabitat)

data <- data.frame(read.table(file='C:/bird1csv',sep=',',header=TRUE,))
xy<-data[,c("x","y")]
id<-data$GLS
href <- Hpi(x=xy)
kudl <- kernelUD(xy, id,h="href")
kver<-getverticeshr(kudl)
spol <- kver2spol(kver)
df <- data.frame(GLS="2575")
spdfBaja <- SpatialPolygonsDataFrame(spol, df, match.ID = FALSE)
writeOGR(spdfBaja,"C:/Locations","bird1",driver="ESRI Shapefile")

# Works but result of KDE using kernelUD doesn't give as much details as kde
# direct transposition of kernelUD by kde does not work since the classes
are different
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.faunalia.it/pipermail/animov/attachments/20131016/e21fa0f2/attachment.html>


More information about the AniMov mailing list