Thanks for the help. I finally understood how the different classes in sp-
package work together. Thus, I could create an image using the following code:

cols <- 10
rows <- 6
grd <- SpatialGrid(GridTopology(cellcentre.offset = c(1,1,1), cellsize = 
                                c(1,1,1), cells.dim = c(cols, rows, 1))) 
x <- SpatialPixelsDataFrame(grd, data = spectral_data)
writeGDAL(x, fname = "example.tif")

All the best

Lukas

Am Samstag, 1. Juni 2013, 09:11:30 schrieb Barry Rowlingson:
> On Sat, Jun 1, 2013 at 6:41 AM, Lukas Lehnert
> 
> <lukaslehnert@googlemail.com> wrote:
> > Thank you for the reply. I made a stupid mistake in the last post. I
> > meant specifying number of bands, rows and columns in the newly created
> > image (and not omitting). I know the raster package and the creation
> > options. However I need to use rgdal and not the raster package for
> > that purpose.
> 
>  Okay, I think we need to get this absolutely clear then...
> 
>  You want to create a file *on disk* - ie your primary interest is not
> in creating an R object, but with creating a file on disk that some
> other application could read.
> 
>  If so, why can't you use the raster package? It's what it's there for.
> 
>  Otherwise, purely using rgdal, you first create a
> SpatialPixelsDataFrame and then save it with writeGDAL(). The
> documentation is all there.
> 
> Barry
	[[alternative HTML version deleted]]

