[R-sig-Geo] creating a geotiff

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Thu Aug 13 16:03:38 CEST 2009


On Thu, Aug 13, 2009 at 1:35 PM, Monica Pisica<pisicandru at hotmail.com> wrote:
>
> Hi,
>
> I have some data as it is required for the function "image" {graphics}, that means a vector x for x coord, a vector y for y coord and a matrix m with x rows and y cols. I want to save this as a geotiff.  If i transform my data to take the form of a 3 column data.frame i can use gridded and writeGDAL to obtain my geotiff, but sincerely it  seems a little silly to do that. Is there any other way in doing it??? I've tried to transform this data in one of the sp objects but .... i was not able to. Any ideas??

 Looking at the code for writeGDAL, it calls create2GDAL which
eventually converts its sp-class back into a matrix anyway!

    for (i in 1:nbands) {
        band = as.matrix(dataset[i])

It should be possible to write something like create2GDAL that
operates on a list(x,y,z) structure and avoid converting to sp-classes
and than back to matrix form. You just need to work out what
gridparameters(xyzlist) looks like, and then it's a simple cut n paste
job...

Actually, I think I did start doing that, but I can't find the code at
the moment....

Barry



More information about the R-sig-Geo mailing list