[R-sig-Geo] class ker (ks) --> conversion --> raster

Nicolas Bergeron nicolas.bergeron at sympatico.ca
Thu Feb 28 03:17:58 CET 2008


Hi All,

I'm searching for the method to convert a class ker (library(ks)) to the format
raster. Can you suggest a possible solution?

This code produces the object of class ker:

# Modules
library(ks)

# xy
xy <- as.matrix(loc[loc$ID_animal == 2004021,c("x","y")])

# HPI-SCALE
HpiScale <- Hpi(x=xy, pilot="samse", pre="scale")
fhat.HpiScale <- kde(x=xy, H = HpiScale)

# Code for conversion
# Export {XY=long,lat, Z=fhat} --> GRASS (r.in.xyz)
XY <- data.frame(x=fhat.HpiScale[[2]][[1]],y=fhat.HpiScale[[2]][[2]])
Z <- fhat.HpiScale[[3]]

... suggestions will appreciate or  others methods to write a text file
of X,Y coordinates and Z value.

after that, in GRASS-GIS r.in.xyz

Thank's

-- 
Nicolas Bergeron




More information about the R-sig-Geo mailing list