[R-sig-Geo] write.asciigrid

Andy Bunn abunn at whrc.org
Fri May 5 17:23:59 CEST 2006


> > I second Roger's recommendation for using rgdal. I've been
> writing to and
> > fro from img files with few problems. The only problem I have
> with ArcGIS is
> > that the statistics have had to be recalculated in Arc for
> floats to get the
> > display to work correctly. But, Arc has a batch statistics tool
> that doesn't
> > crash often (when a tool works reliably in Arc I'm surprised and pleased
> > beyond reason). Keep up the good work Roger, Tim, Edzer and all the
> > rest. -Andy
>
> Thanks for this input, Andy. Could you please flesh it out a little,
> perhaps a run through from SpatialPixels/GridDataFrame to inside ArcGIS
> (version?)? I'll try too, but if you have a well-trodden path ...

    library(sp)
    library(rgdal)
    data(meuse.grid)
    coordinates(meuse.grid) = c("x", "y") # promote to
SpatialPointsDataFrame
    gridded(meuse.grid) <- TRUE # promote to SpatialPixelsDataFrame
    image(meuse.grid["dist"])
    writeGDAL(meuse.grid,"c:/data/research/tmp/meuse.grid.img",
driver="HFA")

Arc can display this img file without issue if the statistics are
reclaculated using the Calculate Statistics under Raster. Note the lack of
projcetion however!

-Andy




More information about the R-sig-Geo mailing list