[R-sig-Geo] rgdal and grass rasters

Dylan Beaudette debeaudette at ucdavis.edu
Tue Mar 2 19:10:07 CET 2010


On Monday 01 March 2010, Jonathan Greenberg wrote:
> As far as sample code goes, simply getting
> grass_to_raster=raster("somegrassfile") is my goal -- my understanding
> is anything rgdal can read, raster can read.  Running your command I
> do get:
>
> GRASS (ro): GRASS Database Rasters (5.7+)
>
> But with rgdal:
>
> require(rgdal)
> gdaldrivers=getGDALDriverNames()
> gdaldrivers$create[gdaldrivers$name=="GRASS"]
> [1] FALSE
> gdaldrivers$copy[gdaldrivers$name=="GRASS"]
> [1] FALSE
> gdaldrivers$create[gdaldrivers$name=="GTiff"]
> [1] TRUE
> gdaldrivers$copy[gdaldrivers$name=="GTiff"]
> [1] TRUE
>
> Am I perhaps missing an rgdal installation flag that is required to
> enable GRASS rasters?
>
> --j

Could be.  How did you install GRASS/GDAL/rgdal?

Dylan

>
>
> On Mon, Mar 1, 2010 at 6:04 PM, Dylan Beaudette
>
> <dylan.beaudette at gmail.com> wrote:
> > Roger can likely point out the problem after some example code is
> > posted. In the mean time I would suggest checking to make sure your
> > GDAL is compiled _without_ GRASS support, and that the GDAL GRASS
> > plugin is correctly installed.
> >
> > This is how I check on my machine:
> >
> > gdal_translate --formats | grep -i grass
> >  GRASS (ro): GRASS Database Rasters (5.7+)
> >
> > Cheers,
> > Dylan
> >
> > On Mon, Mar 1, 2010 at 5:44 PM, Alex Mandel <tech_dev at wildintellect.com> 
wrote:
> >> spgrass6 is a an R package and has read/write access to GRASS datasets.
> >> It's usage would be instead of rgdal(well sorta, rgdal is required by
> >> spgrass6). Both write objects to sp types.
> >> You can use it from within R to start a GRASS session or within GRASS to
> >> start a linked R session.
> >> http://cran.r-project.org/web/packages/spgrass6/index.html
> >>
> >> I got GDALinfo to work on my machine, I wonder if your just missing the
> >> gdal-grass library, or libgrass.
> >>
> >> On ubuntu it's something like libgdal1-1.6.0-grass
> >> I know qgis needs this to work with GRASS not sure about gdal itself but
> >> based on http://gdal.org/frmt_grass.html probably. Also note that page
> >> talks about the path to a dataset that should be used.
> >>
> >>
> >> Thanks,
> >> Alex
> >>
> >>> Hmm, I'm trying to use the raster package via rgdal to access these
> >>> files -- I'm trying to avoid having to export then to another format
> >>> (I'm dealing with gigabytes of rasters), although I suppose I could do
> >>> this.  Does spgrass6 "enable" rgdal to access GRASS rasters, or is it
> >>> its own standalone program?  How does the base gdal package work with
> >>> grass rasters?
> >>>
> >>> --j
> >>>
> >>> On Mon, Mar 1, 2010 at 2:35 PM, Sarah Goslee <sarah.goslee at gmail.com> 
wrote:
> >>>> I think you need to export it from grass first, with r.out.gdal
> >>>>
> >>>> Or you can use spgrass6 to work with R and GRASS directly.
> >>>>
> >>>> Sarah
> >>>>
> >>>> On Mon, Mar 1, 2010 at 5:17 PM, Jonathan Greenberg
> >>>>
> >>>> <greenberg at ucdavis.edu> wrote:
> >>>>> Folks: when trying to import or GDALinfo a grass raster, where,
> >>>>> exactly, should I be pointing to in the grass directory?  I tried
> >>>>> pointing to the file with the same name as the raster I want to work
> >>>>> with in the fcell, cellhd, and cell directories
> >>>>> (grass/location/mapset), but none of these are working...  thanks!
> >>>>
> >>>> --
> >>>> Sarah Goslee
> >>>> http://www.functionaldiversity.org
> >>>
> >>> _______________________________________________
> >>> R-sig-Geo mailing list
> >>> R-sig-Geo at stat.math.ethz.ch
> >>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >>
> >> _______________________________________________
> >> R-sig-Geo mailing list
> >> R-sig-Geo at stat.math.ethz.ch
> >> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



-- 
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341



More information about the R-sig-Geo mailing list