[R-sig-Geo] kde output from ks reversed

andrewaduff andrewaduff at gmail.com
Fri Feb 18 20:01:20 CET 2011


Here is a self contained sample with a different set of points, same issues
though.  When I use your suggested routines for export, I get a slightly
different issue but one I was seeing before my original post.  I avoided
this issue by using the code from my original post create the raster
manually,  Somehow the raster is getting warped in x and y???  When I use
your routines they fail, saying that the cells unequal in horizontal and
vertical dimensions.

*****************************

library(ks)
library(raster)
curset <- read.delim("sample.csv", header = TRUE, sep = ",")

#Calculate hpi
Hpi1 <- Hpi(x = curset, pre="scale")
Hpi1

## Do the kde
ud_hpi <- kde(x = curset, H=Hpi1)

library(raster)
r <- raster(ud_hpi)
plot(r)
writeRaster(r, 'test_r.asc')

*****************************
upon writeRaster I get an error - 

"Error in .startAsciiWriting(raster, filename, ...) : 
  x has unequal horizontal and vertical resolutions. Such data cannot be
stored in arc-ascii format"

http://r-sig-geo.2731867.n2.nabble.com/file/n6041112/sample.csv sample.csv 
http://r-sig-geo.2731867.n2.nabble.com/file/n6041112/sample.r sample.r 
-- 
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/kde-output-from-ks-reversed-tp6037090p6041112.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list