[GRASS-stats] readRAST6 and readVECT6 errors with grass70

Roger Bivand Roger.Bivand at nhh.no
Thu Mar 8 05:42:18 EST 2012


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?

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

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


More information about the grass-stats mailing list