[GRASS-stats] readRAST6 and readVECT6 errors with grass70

Roger Bivand Roger.Bivand at nhh.no
Thu Mar 8 14:39:27 EST 2012


Eric,

The check of spgrass6 gets through readRAST6() with two rasters, which 
sets plugin=FALSE (twice, once not using GDAL, once using GDAL). It fails 
either in readRAST6(elevation.dem", plugin=TRUE, mapset="PERMANENT") if 
"GRASS" %in% gdalDrivers()$name or at writeRAST6(spear, "sqdemSP", 
zcol="sqdem").

My prejudice is to suspect the plugin. Can you do:

library(rgdal)
"GRASS" %in% gdalDrivers()$name
"GRASS" %in% ogrDrivers()$name

If they are TRUE, then the smoking gun is some dependency mixup in the 
GDAL GRASS plugin drivers, possibly pointing to a stale plugin, a stale 
GRASS version linked to GRASS, or something like that. Managing plugins 
across multiple versions of GRASS and/or GDAL is for very off-piste people 
who like excitement, I'm afraid.

The rgdal check suggests that the standard GDAL and OGR drivers work when 
GRASS is not in the picture.

Roger

On Thu, 8 Mar 2012, Eric Momsen wrote:

> On Thu, Mar 8, 2012 at 4:42 AM, Roger Bivand <Roger.Bivand at nhh.no> wrote:
>> I've committed changes to spgrass6 on R-forge, project rspatial as revision
>> 1224, which address the r.info flag issue, and another issue related to my
>> using GDAL 1.9.0, which is less forgiving about overwriting vector files in
>> the temporary directory (but not the cause of your vector problem). I always
>> compile GDAL, GEOS, etc. from source, and do not see any issues with
>> spearfish vector files converted to GRASS 7 (but had to enable sqlite in
>> GRASS to avoid problems). I am always sceptical about Linux binary builds,
>> and cannot replicate this issue (but which may mean that rgdal is broken in
>> some odd way if it was also installed using binary dependencies). Can you
>> run:
>>
>> wget http://cran.r-project.org/src/contrib/rgdal_0.7-8.tar.gz
>> R CMD check rgdal_0.7-8.tar.gz
>>
>> to test the package on your platform?
>
> It seemed OK, ( http://pastebin.com/gykPF4EX ), the only problems were
> with the manual:
>
> * checking PDF version of manual ... WARNING
> LaTeX errors when creating PDF version.
> This typically indicates Rd problems.
> * checking PDF version of manual without hyperrefs or index ... ERROR
> Re-running with no redirection of stdout/stderr.
> Hmm ... looks like a package
> Error in texi2dvi("Rd2.tex", pdf = (out_ext == "pdf"), quiet = FALSE,  :
>  pdflatex is not available
> Error in running tools::texi2dvi
> You may want to clean up by 'rm -rf /tmp/RtmpqvwW8e/Rd2pdf69b337d4f332'
>
>>
>> If you check out rspatial, you will be able to do R CMD check on spgrass6
>> too in its current development revision:
>>
>> svn checkout svn://scm.r-forge.r-project.org/svnroot/rspatial/
>> cd rspatial/pkg
>> (start GRASS7 in spearfish)
>> R CMD check spgrass6
>
>
> full output at:  http://pastebin.com/n6a7SGXh
>
> Everything was OK until:
>
> * checking examples ... ERROR
> Running examples in ‘spgrass6-Ex.R’ failed
> The error most likely occurred in:
>
>> ### Name: readRAST6
>
>
> I did not (yet) move anything or install as packages in R, just ran R
> CMD where the downloaded file was at.
>
> Thanks for your help so far, any suggestion for what to try next?
>
> Eric
>
>>
>> Roger
>>
>>
>>
>>
>> On Tue, 6 Mar 2012, Eric Momsen wrote:
>>
>>> Thank you for the quick response!  I've added follow up after the points
>>> below.
>>>
>>> On Tue, Mar 6, 2012 at 2:25 PM, Roger Bivand <Roger.Bivand at nhh.no> wrote:
>>>>
>>>> On Tue, 6 Mar 2012, Eric Momsen wrote:
>>>>
>>>>> Hello!
>>>>>
>>>>> I have been trying to get spgrass6 working in a Debian environment,
>>>>> and have started from scratch with both GRASS 6.4.3 and GRASS 7.0.  I
>>>>> previously had the same errors in "old" installations of both 6 and 7,
>>>>> after following the advice in the listserve archive I am half way
>>>>> there.  Since the behavior had been the same for both, I was suprised
>>>>> it didn't resolve the issue completely!  Any suggestions would be
>>>>> appreciated.
>>>>>
>>>>> I hope it is OK to include all 3 questions here, since they all relate
>>>>> to spgrass6.  Here is a listing of sessionInfo and various Debian
>>>>> package versions:  http://pastebin.com/68XST1vK
>>>>>
>>>>>
>>>>> My installation of spgrass6 is working now with GRASS 6.4.3, I can
>>>>> read and write vectors and rasters.
>>>>>
>>>>> 1.  I am getting one warning message, is this OK, or am I missing some
>>>>> dependency still?
>>>>>
>>>>>> spear <- readRAST6(c("elevation.dem", "geology"), cat = c(FALSE, TRUE))
>>>>>
>>>>>
>>>>> Warning message:
>>>>> statistics not supported by this driver
>>>>>
>>>>> The program does continue to successfully import the data.
>>>>
>>>>
>>>>
>>>> Not a problem - an artefact of calling GDALinfo() on the temporary file.
>>>
>>>
>>> Great.  After all the real errors I've caused, it is nice to have
>>> reached a point where I can ignore the warnings.
>>>
>>>>
>>>>
>>>>>
>>>>>
>>>>> Moving onto GRASS 7:
>>>>>
>>>>> 2.  readRAST6 gives an error in grass70, output as follows:
>>>>>
>>>>>> spear <- readRAST6(c("geology", "elevation.dem"), cat=c(TRUE, FALSE),
>>>>>
>>>>>
>>>>> + useGDAL=FALSE)
>>>>
>>>>
>>>>
>>>> r.info is called twice, once with -t, once with -r. In GRASS 7, all of
>>>> have
>>>> been collected in -g, which simply breaks compatibility - arguably, -t
>>>> could
>>>> have been left in place. When I find time to build a GRASS 7, I'll try to
>>>> accommodate the broken flag. -r is retained, so it is only on line 48 in
>>>> R/bin_link.R that any change is required.
>>>>
>>>
>>> I changed the flag as suggested and readRAST6 now works for my
>>> installation.
>>>
>>>>> Command: r.info
>>>>> Description: Outputs basic information about a raster map.
>>>>> Keywords: raster, metadata, history
>>>>> Parameters:
>>>>>  name: map, type: string, required: yes, multiple: no
>>>>>  keydesc: name, keydesc_count: 1
>>>>> [Name of raster map]
>>>>> Flags:
>>>>>  name: g [Print raster array information only] {FALSE}
>>>>>  name: r [Print range only] {FALSE}
>>>>>  name: e [Print extended metadata information only] {FALSE}
>>>>>  name: h [Print raster history instead of info] {FALSE}
>>>>>  name: verbose [Verbose module output] {FALSE}
>>>>>  name: quiet [Quiet module output] {FALSE}
>>>>> Error in doGRASS(cmd, flags = flags, ..., parameters = parameters,
>>>>> echoCmd = echoCmd) :
>>>>>  Invalid flag value: t
>>>>>
>>>>> I checked that r.info works:
>>>>>>
>>>>>>
>>>>>> system("r.info geology")
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> +----------------------------------------------------------------------------+
>>>>> | Layer:    geology                        Date: Mon May  4 10:00:14
>>>>> 1987
>>>>> :  |
>>>>> | Mapset:   PERMANENT                      Login of Creator: grass
>>>>>   |
>>>>> | Location: spearfish70
>>>>> .
>>>>> .
>>>>> .
>>>>>
>>>>>
>>>>> I see that -t is in the GRASS6.4.3 version of r.info, but not in the
>>>>> GRASS7.0 version of r.info.
>>>>>
>>>>> I'm not sure what to do next here.
>>>>>
>>>>>
>>>>> 3.  readVECT6 causes R to exit.
>>>>>
>>>>>> bugsDF <- readVECT6("bugsites")
>>>>>
>>>>>
>>>>> GRASS 7.0.svn (spearfish70):~ >
>>>>>
>>>>> I went back to check that the bugsites map was available:
>>>>>>
>>>>>>
>>>>>> system("v.info bugsites")
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> +----------------------------------------------------------------------------+
>>>>> | Name:            bugsites
>>>>>    |
>>>>> | Mapset:          PERMANENT
>>>>>   |
>>>>> | Location:        spearfish70
>>>>>   |
>>>>> | Database:        /home/shared/research/GRASSDATA
>>>>>   |
>>>>> .
>>>>> .
>>>>> .
>>>>>
>>>>> And then tried the debug tool to see where things went wrong...
>>>>>
>>>>> complete output at: http://pastebin.com/dJFsRSBC  with the final lines
>>>>> as:
>>>>>
>>>>> debug: res <- readOGR(dsn, layer = as.character(layer), verbose =
>>>>> !ignore.stderr,
>>>>>   pointDropZ = pointDropZ)
>>>>> Browse[2]>
>>>>
>>>>
>>>>
>>>> I'll look at this later, looks like a broken shapefile.
>>>
>>>
>>> I wasn't sure if you meant my local shapefile was broken?  So I
>>> checked the function on my real data as well as a fresh download of
>>> spearfish.  Neither worked.  I also tried it in a spearfish60
>>> location.
>>>
>>> My spearfish70 is simply spearfish60 after `v.build all` has been run.
>>>
>>>>
>>>> Roger
>>>>
>>>>> GRASS 7.0.svn (spearfish70):~ >
>>>>>
>>>>>
>>>>> I found a 2009 post regarding readOGR / readVECT6 and some versioning
>>>>> issues: https://stat.ethz.ch/pipermail/r-sig-geo/2009-April/005553.html
>>>>> but I installed both rgdal and spgrass6 inside of R as packages.  So
>>>>> I'm not sure if this older post is still applicable, especially since
>>>>> it works in GRASS 6.4.3.  Any suggestions for what to try next?
>>>>>
>>>>>
>>>>> Thanks in advance for any help provided.
>>>>>
>>>>> Eric
>>>>> _______________________________________________
>>>>> grass-stats mailing list
>>>>> grass-stats at lists.osgeo.org
>>>>> http://lists.osgeo.org/mailman/listinfo/grass-stats
>>>>>
>>>>
>>>> --
>>>> Roger Bivand
>>>> Department of Economics, NHH Norwegian School of Economics,
>>>> 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
>>>>
>>>
>>
>> --
>> Roger Bivand
>> Department of Economics, NHH Norwegian School of Economics,
>> 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
>

-- 
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
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