[GRASS-stats] R (spgrass6) / GRASS r.in.gdal error
Alexandre Villers
villers.alexandre at gmail.com
Tue Mar 8 08:46:53 EST 2011
Hey,
the argument band=as.integer(1) works fine (while band=1 doesn't)... I
should have checked that on my own. Sorry for bothering the list with
this and thanks for pointing it to me.
Best regards
Alex
On 08/03/2011 15:43, Roger Bivand wrote:
> On Tue, 8 Mar 2011, Rainer M Krug wrote:
>
>> 2011/3/8 Alexandre Villers <villers.alexandre at gmail.com>:
>>> Sorry for double posting if it did
>>> -------------------------------------------------------------------
>>>
>>> Good afternoon,
>>>
>>> While trying to import a GTiff and process it with spgrass6 with the
>>> following:
>>>
>>> execGRASS("r.in.gdal", flags=c("o","overwrite"),
>>> parameters=list(input="E:/Boulot/WildlifeTrianglesFinland/Covariates/Rainfall/Rain.year1989.tif",
>>>
>>> output="ref", band=1))
>>>
>>> or
>>>
>>> execGRASS("r.in.gdal", flags=c("o","overwrite"),
>>> parameters=list(input="E:/Boulot/WildlifeTrianglesFinland/Covariates/Rainfall/Rain.year1989.tif",
>>>
>>> output="ref", band="1"))
>>>
>>> I get
>>>
>>>
>>> Error in doGRASS(cmd, flags = flags, parameters = parameters) :
>>> Parameter <band> does not have integer value
>>
>> You specified band="1" , which is a character - try band=1
>
> Right, "1" is a character vector of one element. To disambiguate, band
> must be an integer, and 1 will possibly be treated as a numeric, so
> band=1L or band=as.integer(1) ought to be used. Looking at the output
> of parseGRASS() tells you what type the parameter values should be.
>
> Roger
>
>>
>> Disclaimer" I have never used r.in.gdal
>>
>> Cheers,
>>
>> Rainer
>>>
>>> When I do not specify the band value, the two bands of this GTiff are
>>> imported properly....
>>> Any idea ?
>>>
>>>
>>> Alex
>>>
>>> P.S.:
>>>
>>>
>>>> traceback()
>>> 3: stop(paste("Parameter <", names(parameters)[i], "> does not have
>>> integer
>>> value",
>>> sep = ""))
>>> 2: doGRASS(cmd, flags = flags, parameters = parameters)
>>> 1: execGRASS("r.in.gdal", flags = c("o", "overwrite"), parameters =
>>> list(input =
>>> "E:/Boulot/WildlifeTrianglesFinland/Covariates/Rainfall/Rain.year1989.tif",
>>>
>>> output = "ref", band = 1))
>>>> sessionInfo()
>>> R version 2.12.1 (2010-12-16)
>>> Platform: x86_64-pc-mingw32/x64 (64-bit)
>>>
>>> locale:
>>> [1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United
>>> Kingdom.1252 LC_MONETARY=English_United Kingdom.1252
>>> [4] LC_NUMERIC=C LC_TIME=English_United
>>> Kingdom.1252
>>>
>>> attached base packages:
>>> [1] grDevices datasets splines graphics stats tcltk utils
>>> methods base
>>>
>>> other attached packages:
>>> [1] spgrass6_0.6-23 XML_3.2-0.2 rgdal_0.6-33 sp_0.9-78
>>> svSocket_0.9-51 TinnR_1.0.3 R2HTML_2.2 Hmisc_3.8-3
>>> [9] survival_2.36-2
>>>
>>> loaded via a namespace (and not attached):
>>> [1] cluster_1.13.3 grid_2.12.1 lattice_0.19-13 svMisc_0.9-61
>>> tools_2.12.1
>>>
>>> _______________________________________________
>>> grass-stats mailing list
>>> grass-stats at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/grass-stats
>>>
>>>
>>
>>
>>
>>
>
More information about the grass-stats
mailing list