Skip to content

Export kde object as shapefile

1 message · T.D. Rudolph

#
Tyler Dean Rudolph wrote:
Here is a plausible solution from the R-sig-geo forum....
On Fri, Nov 27, 2009 at 5:20 PM, Michael Sumner <mdsumner at gmail.com> wrote:
Here's one way:

    library(ks)

    data(unicef)
    H.scv <- Hscv(x=unicef)
    fhat <- kde(x=unicef, H=H.scv)
    image(fhat$eval.points[[1]], fhat$eval.points[[2]], fhat$estimate)

    library(sp)

    spkde <- image2Grid(list(x = fhat$eval.points[[1]], y =
    fhat$eval.points[[2]], z = fhat$estimate))
    contour(spkde, add = TRUE)