<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7638.1">
<TITLE> RE: ESRI ASCII Grid file shifted</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<BR>
<P><FONT SIZE=2 FACE="Arial">Hi all,</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">I am new to R and would like to get some advice. I performed kernel density estimation using spatstat. The point data (i.e. drawing) is in ESRI shapefile format. It was read in using "readShapePoints" of maptools. After the analysis, the result was exported using "writeAsciiGrid" of maptools. The entire codes are as follows:</FONT></P>
<P><FONT SIZE=2 FACE="Courier New">library(spatstat)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">library(maptools)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">d=readShapePoints("C:/TEMP/shp/drawing")</FONT>
<BR><FONT SIZE=2 FACE="Courier New">w = owin(c(-15000,16500),c(-15000,15000))</FONT>
<BR><FONT SIZE=2 FACE="Courier New">dppp=as(d["DHL_Sales"], "ppp")</FONT>
<BR><FONT SIZE=2 FACE="Courier New">cpt = ppp(x=dppp$x, y=dppp$y, marks=dppp$marks, window=w)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">plot(dppp)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">z = density.ppp(cpt, 500)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">image(z)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">gridded_z = as.SpatialGridDataFrame.im(z)</FONT>
<BR><FONT SIZE=2 FACE="Courier New">writeAsciiGrid(gridded_z, "C:/TEMP/grid/KDE_Store1.asc")</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">When I compared the exported grid file (i.e. KDE_Store1) with the input shapefile (i.e. drawing), I notice that there is a shift in the grid file. Refer to the enclosed screenshoot. I wonder if anyone can advice me whats went wrong.</FONT></P>
<P><FONT SIZE=2 FACE="Arial">Thanks in advance. </FONT>
</P>
<P><FONT FACE="Arial" SIZE=2 COLOR="#000000"> <<KDE1.jpg>> </FONT>
<BR><B><FONT COLOR="#000080" SIZE=2 FACE="Arial">Dr Kam Tin Seong</FONT><FONT COLOR="#000000" SIZE=5 FACE="Arial"></FONT><BR>
<FONT COLOR="#000080" SIZE=2 FACE="Arial">Practice Associate Professor</FONT><FONT COLOR="#000000" FACE="Arial"><BR>
</FONT><FONT COLOR="#000080" SIZE=2 FACE="Arial">School of Information Systems</FONT><FONT COLOR="#000000" FACE="Arial"><BR>
</FONT></B><BR>
<FONT COLOR="#000080" SIZE=2 FACE="Arial">Singapore Management University</FONT><FONT COLOR="#000000" FACE="Times New Roman"><BR>
</FONT><FONT COLOR="#000080" SIZE=2 FACE="Arial">80 Stamford Road</FONT><FONT COLOR="#000000" FACE="Times New Roman"><BR>
</FONT><FONT COLOR="#000080" SIZE=2 FACE="Arial">Singapore 178902</FONT><FONT COLOR="#000000" FACE="Times New Roman"><BR>
</FONT><FONT COLOR="#000080" SIZE=2 FACE="Arial">e-mail:</FONT> <A HREF="mailto:tskam@smu.edu.sg"><U><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">tskam@smu.edu.sg</FONT></U></A><FONT COLOR="#000000" FACE="Times New Roman"><BR>
</FONT><FONT COLOR="#000080" SIZE=2 FACE="Arial">DID: + 65 6828 0932</FONT>
</P>
<BR>
</BODY>
</HTML>