[R-sig-Geo] GDAL problem writing Idrisi format

Roger Bivand Roger.Bivand at nhh.no
Mon Aug 17 14:17:27 CEST 2009


On Fri, 14 Aug 2009, Roger Bivand wrote:

> On Fri, 14 Aug 2009, Alberto Ruiz Moreno wrote:
>
>> I get the error
>> 
>> GDAL Error 4: `C:\DOCUME~1\Temp\Rtmplib5Gm\file5f906952' not recognised as 
>> a supported file format.
>> 
>> When a try to write a SpatialGridDataframe as Idrisi A.1 raster format
>> 
>>> x <- readGDAL(system.file("external/test.ag", package="sp")[1])
>> 
>> C:/ARCHIV~1/R/R-29~1.1/library/sp/external/test.ag has GDAL driver AAIGrid
>> and has 115 rows and 80 columns
>> 
>>> writeGDAL(x,'test.tiff',drivername='GTiff')
>> 
>> That?s OK but..
>> 
>>> writeGDAL(x,'test.rst',drivername='RST')
>> Error en .local(.Object, ...) :
>>        GDAL Error 4: 
>> `C:\DOCUME~1\ARUIZ~1.EEZ\CONFIG~1\Temp\Rtmplib5Gm\file5f906952' not 
>> recognised as a supported file format.
>
> This particular driver is written requiring that all files used must use the 
> *.rst extension for the raw image file. writeGDAL() creates a file 
> corresponding to the required GDAL dataset in the R temporary folder with a 
> temporary name with no extension, so when the correctly constructed file is 
> being opened, the attempt error exits, because the file extension is wrong.
>
> I'll try to find a workaround in the next release of rgdal (after the one on 
> its way to CRAN now). I'll try it on you first, if that's OK - apparently the 
> driver also likes having environment variable IDRISIDIR set pointing to your 
> installed Idrisi.

The fix for the RST driver will be in 0.6-14 which has just been submitted 
to CRAN. The RST driver requires that the coordinate reference system of 
the dataset is specified.

Roger

>
> Roger
>
>
>> 
>>> summary(x)
>> Object of class SpatialGridDataFrame
>> Coordinates:
>>     min    max
>> x 178400 181600
>> y 329400 334000
>> Is projected: NA
>> proj4string : [NA]
>> Number of points: 2
>> Grid attributes:
>>  cellcentre.offset cellsize cells.dim
>> x            178420       40        80
>> y            329420       40       115
>> Data attributes:
>>   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's
>>  128.4   293.2   371.4   423.2   499.8  1806.0  6097.0
>> 
>>> version
>>               _
>> platform       i386-pc-mingw32
>> arch           i386
>> os             mingw32
>> system         i386, mingw32
>> status
>> major          2
>> minor          9.1
>> year           2009
>> month          06
>> day            26
>> svn rev        48839
>> language       R
>> version.string R version 2.9.1 (2009-06-26)
>> 
>> Thank for any comment...
>> 
>> 
>> 
>> 
>> -----------------------------------------------
>> A  l  b  e  r  t  o     R  u  i  z    M  o  r  e  n  o
>> Dept.   Desertificaci?n   y   Geoecolog?a
>> Estaci?n  Expermental de  Zonas ?ridas
>> EEZA - CSIC                     Almer?a - Espa?a
>> ----------------------------------------------
>>                   www.eeza.csic.es
>> -----------------------------------------------
>> 
>>
>> 	[[alternative HTML version deleted]]
>> 
>> 
>
>

-- 
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