<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
<br>
Thanks to Valerio Bartolino and Michael Sumner for their answers.
Michael, thanks in particular for the example, which helped my
experimentation. I think this works!<br>
<br>
It seems that the "as.psp" function requires the shapefile to have
just 1 field (?). In order to get this to work on my street file it
seemed I needed to eliminate all fields except the "population"
field. <br>
<br>
For the record, I did experiment in ESRI with running the kernel on
the line file and a line file converted to a point file at 10ft per
point. Then I looked at the cell x cell correlation (about 1 million
cells). The correlation was 0.9998 but on a big street file
converting to points would be cumbersome.<br>
<br>
Thanks again, Zev<br>
<br>
On 5/26/2011 10:47 AM, Michael Sumner wrote:
<blockquote
cite="mid:BANLkTi=096GvNsZ2WVM3Pm3c7DiriJSmUg@mail.gmail.com"
type="cite">See the spatstat package, and function density.psp -
you can control the standard deviation of the kernel and the grid
output.
<div><br>
</div>
<div>library(spatstat)</div>
<div><br>
</div>
<div>?density.psp</div>
<div><br>
</div>
<div>example(density.psp)</div>
<div><br>
</div>
<div><br>
</div>
<div>A dummy example using shapefile data in the rgdal package: </div>
<div><br>
</div>
<div>library(rgdal)</div>
<div>library(maptools)</div>
<div>## data folder in rgdal</div>
<div>
<div>dsn <- system.file("vectors", package = "rgdal")[1]</div>
</div>
<div><br>
</div>
<div>## read a shapefile line "layer"</div>
<div>
<div>kiritimati_primary_roads <- readOGR(dsn=dsn,
layer="kiritimati_primary_roads")</div>
</div>
<div><br>
</div>
<div>## coerce to spatstat's psp object</div>
<div><br>
</div>
<div>
<div>psp.kpr <- as.psp(kiritimati_primary_roads)</div>
<div><br>
</div>
<div>## im object </div>
<div>dens <- density(psp.kpr)</div>
<div>plot(dens)</div>
<div><br>
</div>
<div>plot(psp.kpr, add = TRUE)</div>
<div><br>
</div>
<div>In package spatstat see vignette("shapefiles"), in sp see
vignette("sp"). The maptools package also has an alternative
for reading shapefiles and provides methods for coercion
between classes beyond those in each package to and from the
Spatial classes in sp. </div>
<div><br>
</div>
<div>Cheers, Mike. </div>
<div><br>
</div>
<div class="gmail_quote">On Fri, May 27, 2011 at 12:19 AM, Zev
Ross <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:zev@zevross.com">zev@zevross.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
Hi All,<br>
<br>
Has anyone done kernel density estimation on line "features"
in R similar to what can be computed in ArcGIS (link below)?
They have a kernel density for line features but it only
supports one kernel function -- I'd like to experiment with
different kernels.<br>
<br>
Zev<br>
<br>
<a moz-do-not-send="true"
href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/How_Kernel_Density_works/009z00000011000000/"
target="_blank">http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/How_Kernel_Density_works/009z00000011000000/</a><br>
<br>
-- <br>
Zev Ross<br>
ZevRoss Spatial Analysis<br>
120 N Aurora, Suite 3A<br>
Ithaca, NY 14850<br>
<a moz-do-not-send="true" href="tel:607-277-0004"
value="+16072770004" target="_blank">607-277-0004</a> (phone)<br>
<a moz-do-not-send="true" href="tel:866-877-3690"
value="+18668773690" target="_blank">866-877-3690</a> (fax,
toll-free)<br>
<a moz-do-not-send="true" href="mailto:zev@zevross.com"
target="_blank">zev@zevross.com</a><br>
<br>
_______________________________________________<br>
R-sig-Geo mailing list<br>
<a moz-do-not-send="true"
href="mailto:R-sig-Geo@r-project.org" target="_blank">R-sig-Geo@r-project.org</a><br>
<a moz-do-not-send="true"
href="https://stat.ethz.ch/mailman/listinfo/r-sig-geo"
target="_blank">https://stat.ethz.ch/mailman/listinfo/r-sig-geo</a><br>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
Michael Sumner<br>
Institute for Marine and Antarctic Studies, University of
Tasmania<br>
Hobart, Australia<br>
e-mail: <a moz-do-not-send="true"
href="mailto:mdsumner@gmail.com">mdsumner@gmail.com</a><br>
</div>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Zev Ross
ZevRoss Spatial Analysis
120 N Aurora, Suite 3A
Ithaca, NY 14850
607-277-0004 (phone)
866-877-3690 (fax, toll-free)
<a class="moz-txt-link-abbreviated" href="mailto:zev@zevross.com">zev@zevross.com</a></pre>
</body>
</html>