[R-sig-Geo] Problem loading GRASS 6.3.0 raster

Rainer M Krug r.m.krug at gmail.com
Wed Mar 11 07:48:38 CET 2009


On Tue, Mar 10, 2009 at 7:07 PM, Roger Bivand <Roger.Bivand at nhh.no> wrote:
> On Tue, 10 Mar 2009, Rainer M Krug wrote:
>
>> Hi
>>
>> I want to load a raster from GRASS with readRAST6(..., useGDAL=TRUE),
>> but I get the following error:
>>
>> Error in .local(.Object, ...) :
>>       GDAL Error 4:
>>
>> `/tmp/15827.1.default.q/simASM.CapePeninsula.15827.1/grass/simulation/.tmp/comp017/HSericea_dc_2007'
>> does not exist in the file system,
>> and is not recognised as a supported dataset name.
>
> Rainer,
>
> Two extra pieces of information might be helpful, the traceback() of the
> error (to see which R code was used last) and the GRASS version. If you felt
> like running readRAST6() under debug(), it would be even clearer whether
> execution is following the plugin or r.out.gdal forks in the code.


Hi Roger

Here is the additional info you asked for:

GRASS version: 6.3.0

traceback():
> tmp <- readRAST6("MASK", useGDAL=TRUE)

> tmp <- readRAST6("MASK", useGDAL=FALSE)
Creating BIL support files...
Header File =
/home/rkrug/Documents/Projects/AlienSpread/R/../grass/simulation/.tmp/ecolmod/MASK.hdr
World File =
/home/rkrug/Documents/Projects/AlienSpread/R/../grass/simulation/.tmp/ecolmod/MASK.wld
Exporting raster as floating values (bytes=4)
Using the current region settings...
north=6263000.000000
south=6242000.000000
east=653000.000000
west=574000.000000
r=210
c=790

> tmp <- readRAST6("MASK", useGDAL=TRUE)
Sorry, <c> is not a valid flag
Error in .local(.Object, ...) :

	GDAL Error 4: `/home/rkrug/Documents/Projects/AlienSpread/R/../grass/simulation/.tmp/ecolmod/MASK'
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, PACKAGE = "rgdal")
7: .local(.Object, ...)
6: initialize(value, ...)
5: initialize(value, ...)
4: new("GDALReadOnlyDataset", filename)
3: GDAL.open(fname)
2: readGDAL(rtmpfl11, p4s = getLocationProj(), silent = ignore.stderr)
1: readRAST6("MASK", useGDAL = TRUE)
>


last lines of debug(readRAST6):
Browse[1]>
debug: if (useGDAL && G63) {
    type <- ifelse(to_int, "Int32", "Float32")
    cmd <- paste(paste("r.out.gdal", .addexe(), sep = ""), " -c
--quiet input=",
        vname[i], " output=", gtmpfl11, " type=", type, " nodata=",
        NODATA, sep = "")
    tull <- ifelse(.Platform$OS.type == "windows", system(cmd),
        system(cmd, ignore.stderr = ignore.stderr))
    res <- readGDAL(rtmpfl11, p4s = getLocationProj(), silent = ignore.stderr)
    names(res) <- vname[i]
} else {
    cmd <- paste(paste("r.out.bin", .addexe(), sep = ""), " -b input=",
        vname[i], " output=", gtmpfl11, " null=", NODATA, sep = "")
    tull <- ifelse(.Platform$OS.type == "windows", system(cmd),
        system(cmd, ignore.stderr = ignore.stderr))
    res <- readBinGrid(rtmpfl11, colname = vname[i], proj4string = p4,
        integer = to_int)
}
Browse[1]>
debug: type <- ifelse(to_int, "Int32", "Float32")
Browse[1]>
debug: cmd <- paste(paste("r.out.gdal", .addexe(), sep = ""), " -c
--quiet input=",
    vname[i], " output=", gtmpfl11, " type=", type, " nodata=",
    NODATA, sep = "")
Browse[1]>
debug: tull <- ifelse(.Platform$OS.type == "windows", system(cmd), system(cmd,
    ignore.stderr = ignore.stderr))
Browse[1]>
Sorry, <c> is not a valid flag
debug: res <- readGDAL(rtmpfl11, p4s = getLocationProj(), silent =
ignore.stderr)
Browse[1]>
Error in .local(.Object, ...) :

	GDAL Error 4: `/home/rkrug/Documents/Projects/AlienSpread/R/../grass/simulation/.tmp/ecolmod/MASK'
does not exist in the file system,
and is not recognised as a supported dataset name.


and

last lines of debug(readGDAL)

Browse[1]>
debug: if (nchar(fname) == 0) stop("empty file name")
Browse[1]>
debug: x = GDAL.open(fname)
Browse[1]>
Error in .local(.Object, ...) :

	GDAL Error 4: `/home/rkrug/Documents/Projects/AlienSpread/R/../grass/simulation/.tmp/ecolmod/MASK'
does not exist in the file system,
and is not recognised as a supported dataset name.


finally  debug(GDAL.open):
> tmp <- readRAST6("MASK", useGDAL=TRUE)
Sorry, <c> is not a valid flag
debugging in: GDAL.open(fname)
debug: {
    res <- if (read.only)
        new("GDALReadOnlyDataset", filename)
    else new("GDALDataset", filename)
    res
}
Browse[1]>
debug: res <- if (read.only) new("GDALReadOnlyDataset", filename) else
new("GDALDataset",
    filename)
Browse[1]>
Error in .local(.Object, ...) :

	GDAL Error 4: `/home/rkrug/Documents/Projects/AlienSpread/R/../grass/simulation/.tmp/ecolmod/MASK'
does not exist in the file system,
and is not recognised as a supported dataset name.


readRAST("MASK", useGDAL=FALSE) is working.

If you need any further info, just let me know.

Rainer

>

>
>
>
> I ask about the GRASS version because I seem to remember a file name length
> limitation in older versions.
>
> Roger
>
>
>>
>> When I use readRAST6(..., useGDAL=FALSE)
>> it works.
>>
>> I am using R 2.7.2, spgrass 0.5.18 and rgdal 0.6.7
>>
>> GDAL is compiled without GRASS support, but the plugin is installed.
>>
>>
>> Rainer
>>
>>
>>
>>
>
> --
> 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
>
>



-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Faculty of Science
Natural Sciences Building
Private Bag X1
University of Stellenbosch
Matieland 7602
South Africa



More information about the R-sig-Geo mailing list