  Am 22.12.2010 15:34, schrieb Maxime Pauwels:
> Hi Carsten,
>
> Thanks for your help. I never used rgdal before and therefore do not 
> understand what drivername is.
> When I try your proposition, I ve got the following error message:
>
> Error in .local(.Object, ...) :
>         GDAL Error 6: GDALDriver::Create() ... no create method 
> implemented for this format.
>
> Where am I wrong?
>
> best regards,
>
> max
>
>
>
> Le 21/12/2010 12:21, Carsten Neumann a écrit :
>>  Am 20.12.2010 18:02, schrieb Maxime Pauwels:
>>> Hi list,
>>>
>>> I'm using the sp package to grid data. I'd now like to export the 
>>> grid in either .asc or .grd files. Does anyone can give me the 
>>> package and function that does it easily?
>>>
>>> Thanks,
>>>
>>> max
>>>
>> Hi Max,
>>
>> library(raster); use with function: writeRaster("raster object", 
>> "name", format="ascii"); format="raster" for *.grd files
>>
>> library(rgdal); use with function: writeGDAL("rgdal object", 
>> fname="name", drivername="AAIGrid"); use gdalDrivers() to identify 
>> your preferred drivername for *.grd
>>
>> you certainly have to change your grid object to a raster object when 
>> using raster package.
>>
>> All the best!
>>
>> Carsten
>>
>
Hi Max,

ah ok then the driver "AAIGrid" doesn't have a create call, so you can 
only copy datastructure from a given file like:
writeGDAL("/your Grid/", fname="name", drivername="GTiff")
#######open your saved tiff file#######
a1<-GDAL.open(/your tiff-file/)
################################
a2<-copyDataset(a1,driver="AAIGrid")
################################
saveDataset(a2,/name/)

but it is much more simple either to choose a driver with a create 
option (gdalDrivers()), or to convert your SpatialGridDataFrame to a 
RasterLayer object:

a1<-raster(your Grid)
writeRaster("a1", "/name/", format="ascii")

I hope this helps. If not you can give me a  small part of your data 
including the routines on how you create this and I will send back a script.

Best regards!

Carsten


	[[alternative HTML version deleted]]

