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

Michael Sumner mdsumner at utas.edu.au
Wed Oct 24 13:19:07 CEST 2007


I have used that function many times with no apparent problems, so I 
would be more than happy for it to be included in the sp suite! 

Cheers, Mike.


Roger Bivand wrote:
> 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
>>
>




More information about the R-sig-Geo mailing list