[R-sig-Geo] Export akima grid with gdal

Roger Bivand Roger.Bivand at nhh.no
Wed Oct 24 09:37:15 CEST 2007


On Wed, 24 Oct 2007, Michael Sumner wrote:

> Hi, not sure if sp already has something like this, but it's fairly
> simple anyway. I have this function in the package "trip". "x" is a
> standard R XYZ list object, as expected by image():
>
>
> image2Grid <-
> function (x, p4 = NA)
> {
>    if (!all(names(x) %in% c("x", "y", "z")))
>        stop("image must have components x, y, and z")
>    cells.dim <- dim(x$z)
>    xx <- x$x
>    yy <- x$y
>    lx <- length(xx)
>    ly <- length(yy)
>    if (all(c(lx, ly) == (cells.dim + 1))) {
>        print("corners")
>        xx <- xx[-1] - diff(xx[1:2])/2
>        yy <- yy[-1] - diff(yy[1:2])/2
>    }
>    SpatialGridDataFrame(GridTopology(c(xx[1], yy[1]), c(diff(xx[1:2]),
>        diff(yy[1:2])), cells.dim), data.frame(z = as.vector(x$z[,
>        ncol(x$z):1])), proj4string = CRS(p4))
> }

There is a method to coerce from a matrix to a SpatialGridDataFrame, but 
not for the (x, y, z) list case - if it would be sensible, and if you 
agree, we could easily add it.

Roger


>
>
> ==============Original message text===============
> On Wed, 24 Oct 2007 12:34:17 +1100 paallen at attglobal.net wrote:
>
> Hi all,
>
> I have gridded some data using akima's
> interp.new() function.  I now want to export to
> something that ArcGIS can read directly.  I was
> thinking about something like a geotiff, or a
> simple bil.
>
> How do I export this akima list object using gdal?
> In know that I have to convert the list to a
> spatialgrid but I just cannot manage it.
>
> thanks,
>
> Phillip J. Allen
> Geochemist.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
> ===========End of original message text===========
>
>
>
> If it wasn't backed-up, then it wasn't important. ~ Anon sysadmin
>
> Mike Sumner (Phd. Candidate)
> http://www.antcrc.utas.edu.au/~mdsumner/ http://www.zoo.utas.edu.au/awru/  IASOS/AWRU
> University of Tasmania
> Private Bag 80
> Hobart Tasmania 7001
> AUSTRALIA
> Email: mdsumner at utas.edu.au
> Phone: 03 6226 1752 (W)
>       0408599921   (M)
> Fax:   03 6226 2745
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no




More information about the R-sig-Geo mailing list