<!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 -->

<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.&nbsp; I performed kernel density estimation using spatstat.&nbsp; The point data (i.e. drawing) is in ESRI shapefile format.&nbsp; It was read in using &quot;readShapePoints&quot; of maptools.&nbsp; After the analysis, the result was exported using &quot;writeAsciiGrid&quot; of maptools.&nbsp; 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(&quot;C:/TEMP/shp/drawing&quot;)</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[&quot;DHL_Sales&quot;], &quot;ppp&quot;)</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, &quot;C:/TEMP/grid/KDE_Store1.asc&quot;)</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.&nbsp; Refer to the enclosed screenshoot.&nbsp; I wonder if anyone can advice me whats went wrong.</FONT></P>

<P><FONT SIZE=2 FACE="Arial">Thanks in advance.&nbsp;&nbsp; </FONT>
</P>

<P><FONT FACE="Arial" SIZE=2 COLOR="#000000"> &lt;&lt;KDE1.jpg&gt;&gt; </FONT><FONT FACE="Arial" SIZE=2 COLOR="#000000"> &lt;&lt;drawing.zip&gt;&gt; </FONT>
</P>

<P><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>