[R-sig-Geo] ESRI ASCII Grid file shifted

KAM Tin Seong tskam at smu.edu.sg
Tue Jun 19 05:21:23 CEST 2007


> Hi all,
> 
> 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:
> 
> library(spatstat)
> library(maptools)
> d=readShapePoints("C:/TEMP/shp/drawing")
> w = owin(c(-15000,16500),c(-15000,15000))
> dppp=as(d["DHL_Sales"], "ppp")
> cpt = ppp(x=dppp$x, y=dppp$y, marks=dppp$marks, window=w)
> plot(dppp)
> z = density.ppp(cpt, 500)
> image(z)
> gridded_z = as.SpatialGridDataFrame.im(z)
> writeAsciiGrid(gridded_z, "C:/TEMP/grid/KDE_Store1.asc")
> 
> 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.
> 
> Thanks in advance.   
> 
>  <<KDE1.jpg>> 
> Dr Kam Tin Seong 
> Practice Associate Professor 
> School of Information Systems 
> 
> Singapore Management University 
> 80 Stamford Road 
> Singapore 178902 
> e-mail: tskam at smu.edu.sg 
> DID: + 65 6828 0932
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20070619/0302d480/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: KDE1.jpg
Type: image/jpeg
Size: 37650 bytes
Desc: KDE1.jpg
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20070619/0302d480/attachment.jpg>


More information about the R-sig-Geo mailing list