[GRASS-user] How to import R-generated .gri/.grd raster files in grass ?

Alex Mandel tech_dev at wildintellect.com
Wed Feb 19 16:26:57 PST 2014


Start with the docs for 'raster'
http://cran.r-project.org/web/packages/raster/

specifically pg7
http://cran.r-project.org/web/packages/raster/vignettes/Raster.pdf
pg 200
http://cran.r-project.org/web/packages/raster/raster.pdf

In R you'll need to install first:
install.packages(c('rgdal','raster'))
library(raster)
Then you can use the commands in the docs.

Then if you need help try the R-sig-geo mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

On 02/19/2014 02:36 PM, Rob Bowen wrote:
> Hi Alex,
> 
> Thanks for the quick response. I am a newbie and will need to get up to
> speed on even the basic steps in these programs.
> 
> Rob
> 
> 
> On Wed, Feb 19, 2014 at 2:26 PM, Alex Mandel <tech_dev at wildintellect.com>wrote:
> 
>> More information:
>> http://cran.r-project.org/web/packages/raster/vignettes/rasterfile.pdf
>> So yes easiest option is to open with R and use the raster package/rgdal
>> to save it out to another format that GRASS can read.
>>
>>
>> Maybe we should ask gdal to add the format, seems easy enough and I know
>> the author of raster would be fine with it. Anyone on the gdal list want
>> to forward the idea.
>>
>> Thanks,
>> Alex
>>
>>
>> On 02/19/2014 06:43 AM, Rainer M Krug wrote:
>>> Antonello Lobianco <antonello at lobianco.org> writes:
>>>
>>>> I received some data in .grd + .gri format, where the first one is a
>> small
>>>> text file and the second one (having the same name) is a medium/large
>>>> binary file.
>>>
>>> I don't think you can. This is, as far as I remember, an internal format
>>> of the raster package in R to save raster data.
>>> You effectively have two options:
>>>
>>> 1) use R and the raster package to load the data and to save it in a
>>> different format
>>>
>>> 2) ask the person to do it for you
>>>
>>> Hope this helps,
>>>
>>> Rainer
>>>
>>>>
>>>> I am unable to open them in grass/qgis (I may have not tried all the
>>>> options.. but almost all!).
>>>>
>>>> Any hint ? Which grid format is it ? Am I missing some library ? I
>> tried to
>>>> use google but unfortunately "r" word is too small, and it ends to refer
>>>> always to the r.* commands in grass...
>>>>
>>>> This is the content of the .grd file:
>>>>
>>>> [general]
>>>> creator=R package 'raster'
>>>> created= 2013-12-14 15:44:30
>>>> [georeference]
>>>> nrows= 134
>>>> ncols= 143
>>>> xmin= 56000
>>>> ymin= 1613000
>>>> xmax= 1200000
>>>> ymax= 2685000
>>>> projection= NA
>>>> [data]
>>>> datatype= FLT8S
>>>> byteorder= little
>>>> nbands= 5
>>>> bandorder= BIL
>>>> minvalue= 0:0:0:0:0
>>>> maxvalue= 0.945:1:1:1:1
>>>> nodatavalue= -1.7e+308
>>>> [legend]
>>>> legendtype=
>>>> values=
>>>> color=
>>>> [description]
>>>> layername= Value:Twin:Psum:pH:CN
>>>> history=
>>>>
>>>> Thank you,
>>>>
>>>>        Antonello
>>>
>>>
>>>
>>> _______________________________________________
>>> grass-user mailing list
>>> grass-user at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/grass-user
>>>
>>
>> _______________________________________________
>> grass-user mailing list
>> grass-user at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/grass-user
>>
> 
> 
> 



More information about the grass-user mailing list