[GRASS-stats] readRAST6() error (Windows XP and W2k)

Roger Bivand Roger.Bivand at nhh.no
Sat Nov 14 10:33:00 EST 2009


On Sat, 14 Nov 2009, Martin Mainzer wrote:

> Roger Bivand schrieb am 08.11.2009 09:33:
>> On Thu, 5 Nov 2009, Roger Bivand wrote:
>> 
>>> On Thu, 5 Nov 2009, Martin Mainzer wrote:
>>> 
>>>> Hello at all
>>>> 
>>>> I use R to do statistics of some GRASS data. On the windows machines (XP
>>>> and W2K) there occurred a problem when using the readRAST6 command form
>>>> the spgrass6 library. I think the problem is linked to the standard
>>>> installation of the GRASS standalone installer (standalone version:
>>>> WinGRASS-6.4.0SVN-r39626-1-Setup.exe).
>>> 
>>> Thanks, this is a clear report. I'll try to follow it up - it is in the 
>>> r.out.gdal -> readGDAL part of readRAST6, where maybe extra protection is 
>>> needed on the way through.
>> 
>> Please try the draft package:
>> 
>> http://spatial.nhh.no/R/Devel/spgrass6_0.6-12.zip
>> 
>> which should protect those spaces. Source fixes commited to the spgrass6 
>> module on r-spatial on sourceforge.
> With the draft package, the readRAST6() works fine, also with spaces in 
> pathnames.

Thanks, submitted to CRAN.

Roger

>
> Thanks,
> Martin
>> 
>> However, in working on this, I found a similar problem in this Windows 
>> release inside v.db.addtable, in Markus Neteler's vect2neigh() function. 
>> The problem may have been present before - I checked because vect2neigh had 
>> not been converted to execGRASS() from system() because of space protection 
>> problems in the value of columns=. Having tried to fix space protection in 
>> the parsing of the interface descriptions, I had hoped that vect2neigh() 
>> would now work on Windows (including cases with spaces in the path to the 
>> vector). When there are no spaces, vect2neigh() now works on the Windows 
>> platform. It gets some of the way, but v.db.addtable fails on space 
>> parsing:
>> 
>> # Using vector map name extended by layer number as table name: \
>>  landuse175a_2
>> #Creating table with columns (cat integer, left integer,right \
>>  integer,length double precision)
>> # The table <landuse175a_2> is now part of vector map <landuse175a> and may
>> # be deleted or overwritten by GRASS modules
>> # Select privileges were granted on the table
>> # Reading features...
>> #
>> # and: no such driver available
>> # WARNING: Unable to start driver <and>
>> # ERROR: Unable to open database <C:\Documents> by driver <and>
>> # Current attribute table links:
>> # layer <1> table <landuse175a> in database <C:\Documents and \
>>  Settings\s1155\My Documents\GIS DataBase/Spearfish60/s1155/dbf/> \
>>  through driver <dbf> with key <cat>
>> # layer <2> table <landuse175a_2> in database <C:\Documents> through \
>>  driver <and> with key <cat>
>> # Vector map <landuse175a at s1155> is connected by:
>> 
>> (line breaks indicated by \)
>> 
>> for command:
>> 
>> execGRASS("v.db.addtable", parameters=list(map=vname2a,
>>         layer=as.integer(2),
>>         columns="left integer,right integer,length double precision"),
>>         ignore.stderr=ignore.stderr)
>> 
>> This works for path strings to the vector with no spaces.
>> 
>> Best wishes,
>> 
>> Roger
>> 
>> 
>>> 
>>> Roger
>>> 
>>>> The standalone installer creates a folder named "GIS DataBase" under "My
>>>> Documents" (note the blank in the folder name). To test where the
>>>> problem is, I renamed the folder to "GISDataBase" and moved it to E:\.
>>>> With this configuration everything works fine. I guess there is a
>>>> problem with the blank in the folder name that is created during the
>>>> installation. But this is just a guess. I hope the experts will find the
>>>> problem. Here some information out of R (version 7.10.0) after calling R
>>>> via "Rgui.exe" in the wxpython GUI ("cmd" in the lower part of the
>>>> window "GRASS GIS Ebenen-Manager"). For the example here I used the
>>>> South-Dakota data set. First with the folder name with blanks (the
>>>> folder name from the standard installation):
>>>> ###
>>>>> library(spgrass6)
>>>> Lade nötiges Paket: sp
>>>> Lade nötiges Paket: rgdal
>>>> Geospatial Data Abstraction Library extensions to R successfully loaded
>>>> Loaded GDAL runtime: GDAL 1.6.2, released 2009/07/31
>>>> Path to GDAL shared files: C:/Programme/R/R-2.10.0/library/rgdal/gdal
>>>> Loaded PROJ.4 runtime: Rel. 4.6.1, 21 August 2008
>>>> Path to PROJ.4 shared files: C:/Programme/R/R-2.10.0/library/rgdal/proj
>>>> Lade nötiges Paket: XML
>>>> GRASS GIS interface loaded with GRASS version: 6.4.0svn
>>>> and location: South-Dakota
>>>> 
>>>>> gmeta6()
>>>> gisdbase    E:\martin\daten\GIS DataBase
>>>> location    South-Dakota
>>>> mapset      PERMANENT
>>>> rows        466
>>>> columns     633
>>>> north       4928000
>>>> south       4914020
>>>> west        590010
>>>> east        609000
>>>> nsres       30
>>>> ewres       30
>>>> projection  +proj=utm +zone=13 +a=6378206.4 +rf=294.9786982 +no_defs
>>>> +nadgrids=C:/GRASS-6-SVN/etc/nad/conus +to_meter=1.0
>>>> 
>>>>> map <- readRAST6('geology')
>>>> Tut mir leid, <DataBase/South-Dakota/PERMANENT/.tmp/geology> ist keine
>>>> erlaubte Option
>>>> CPL ERROR 4: `E:/martin/daten/GIS
>>>> DataBase/South-Dakota/PERMANENT/.tmp/geology' does not exist in the file
>>>> system,
>>>> and is not recognised as a supported dataset name.
>>>> 
>>>> Fehler in .local(.Object, ...) :
>>>>  `E:/martin/daten/GIS DataBase/South-Dakota/PERMANENT/.tmp/geology'
>>>> does not exist in the file system,
>>>> and is not recognised as a supported dataset name.
>>>> 
>>>>> traceback()
>>>> 8: .Call("RGDAL_OpenDataset", as.character(filename), TRUE, silent,
>>>>       PACKAGE = "rgdal")
>>>> 7: .local(.Object, ...)
>>>> 6: initialize(value, ...)
>>>> 5: initialize(value, ...)
>>>> 4: new("GDALReadOnlyDataset", filename, silent = silent)
>>>> 3: GDAL.open(fname, silent = silent)
>>>> 2: readGDAL(rtmpfl11, p4s = getLocationProj(), silent = ignore.stderr)
>>>> 1: readRAST6("geology")
>>>> 
>>>>> sessionInfo()
>>>> R version 2.10.0 (2009-10-26)
>>>> i386-pc-mingw32
>>>> 
>>>> locale:
>>>> [1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252
>>>> [3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
>>>> [5] LC_TIME=German_Germany.1252
>>>> 
>>>> attached base packages:
>>>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>>> 
>>>> other attached packages:
>>>> [1] spgrass6_0.6-11 XML_2.6-0       rgdal_0.6-20    sp_0.9-44
>>>> 
>>>> loaded via a namespace (and not attached):
>>>> [1] grid_2.10.0     lattice_0.17-26
>>>> 
>>>> ## #
>>>> And now with a folder name without blanks:
>>>> ###
>>>> 
>>>>> library(spgrass6)
>>>> Lade nötiges Paket: sp
>>>> Lade nötiges Paket: rgdal
>>>> Geospatial Data Abstraction Library extensions to R successfully loaded
>>>> Loaded GDAL runtime: GDAL 1.6.2, released 2009/07/31
>>>> Path to GDAL shared files: C:/Programme/R/R-2.10.0/library/rgdal/gdal
>>>> Loaded PROJ.4 runtime: Rel. 4.6.1, 21 August 2008
>>>> Path to PROJ.4 shared files: C:/Programme/R/R-2.10.0/library/rgdal/proj
>>>> Lade nötiges Paket: XML
>>>> GRASS GIS interface loaded with GRASS version: 6.4.0svn
>>>> and location: South-Dakota
>>>> 
>>>>> gmeta6()
>>>> gisdbase    E:\GISDataBase
>>>> location    South-Dakota
>>>> mapset      PERMANENT
>>>> rows        466
>>>> columns     633
>>>> north       4928000
>>>> south       4914020
>>>> west        590010
>>>> east        609000
>>>> nsres       30
>>>> ewres       30
>>>> projection  +proj=utm +zone=13 +a=6378206.4 +rf=294.9786982 +no_defs
>>>> +nadgrids=C:/GRASS-6-SVN/etc/nad/conus +to_meter=1.0
>>>> 
>>>>> map <- readRAST6('geology')
>>>> E:/GISDataBase/South-Dakota/PERMANENT/.tmp/geology has GDAL driver GTiff
>>>> and has 466 rows and 633 columns
>>>> 
>>>>> traceback()
>>>> Kein traceback vefügbar
>>>> 
>>>>> sessionInfo()
>>>> R version 2.10.0 (2009-10-26)
>>>> i386-pc-mingw32
>>>> 
>>>> locale:
>>>> [1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252
>>>> [3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
>>>> [5] LC_TIME=German_Germany.1252
>>>> 
>>>> attached base packages:
>>>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>>> 
>>>> other attached packages:
>>>> [1] spgrass6_0.6-11 XML_2.6-0       rgdal_0.6-20    sp_0.9-44
>>>> 
>>>> loaded via a namespace (and not attached):
>>>> [1] grid_2.10.0     lattice_0.17-26
>>>> 
>>>> ###
>>>> I hope this help to solve the problem.
>>>> 
>>>> Martin
>

-- 
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 grass-stats mailing list