Skip to content

file format error with R and GRASS61

7 messages · Kirk R. Wythers, Roger Bivand, Scott Mitchell +1 more

#
I am trying to figure out an GDAL error message about grass file not  
being a supported format. The message is:

 > gmeta6 <- gmeta6()
 > fname <- paste(gmeta6$GISDBASE, gmeta6$LOCATION_NAME,
+ "PERMANENT", "cellhd", "soils.ph",
+ sep="/")
 > soilsph_GDAL <- read.GDAL(fname)
Error in .local(.Object, ...) :
         GDAL Error 4: `~/grassdata/spearfish60/PERMANENT/cellhd/ 
soils.ph' not recognised as a supported file format.

This is on grass61 and R 2.2.1 using the spearfish60 location

Thanks in advance for any ideas
#
On Thu, 19 Jan 2006, Kirk R. Wythers wrote:

            
If r.out.gdal works for you on that file, then we have a problem. However, 
I think that your GRASS GDAL plugin is not present, so GDAL doesn't know 
how to read GRASS rasters natively. What does
say within R after loading the rgdal package, or equivalently

$ gdalinfo --formats

from the shell prompt? If you see "GRASS" there, we have a problem, if 
not, please make sure the GDAL GRASS plugin is installed and working (one 
does this *after* installing GRASS.

Roger

  
    
#
On Jan 19, 2006, at 3:06 PM, Roger Bivand wrote:

            
> getGDALDriverNames()
[1] "VRT"       "GTiff"     "NITF"      "HFA"       "SAR_CEOS"  "CEOS"
[7] "ELAS"      "AIG"       "AAIGrid"   "SDTS"      "OGDI"      "DTED"
[13] "PNG"       "JPEG"      "MEM"       "JDEM"      "GIF"       "ESAT"
[19] "BSB"       "XPM"       "BMP"       "AirSAR"    "RS2"        
"PCIDSK"
[25] "PCRaster"  "ILWIS"     "RIK"       "GMT"       "netCDF"    "HDF4"
[31] "HDF4Image" "PNM"       "DOQ1"      "DOQ2"      "ENVI"      "EHdr"
[37] "PAux"      "MFF"       "MFF2"      "FujiBAS"   "GSC"       "FAST"
[43] "BT"        "LAN"       "CPG"       "IDA"       "NDF"        
"JPEG2000"
[49] "L1B"       "FIT"       "RMF"       "USGSDEM"   "GXF"
 >
the same
I thought I had this installed. You are talking about Frank's 1.3.1  
version gdal, right?

I used the config options:

./configure --mandir=/usr/local/share/man --without-python --with- 
threads --with
-static-proj4=/usr/local --with-libtiff=/usr/local --with-geotiff=/ 
usr/local --w
ith-jpeg=/usr/local --with-gif=/usr/local --with-png=/usr/local -- 
with-jasper=/u
sr/local --with-pg=/usr/local/pgsql/bin/pg_config --with-mysql=/usr/ 
local/mysql/
bin/mysql_config --with-netcdf=/Volumes/disk1/home1/kwythers/src/ 
netcdf-3.6.0-p1
--with-hdf4=/Volumes/disk1/home1/kwythers/src/HDF4.2r1/hdf4-darwin - 
with-ogdi=/
usr/local --with-geos=/usr/local/bin/geos-config --with-grass=/usr/ 
local/grass-6
.1.cvs
#
On Jan 19, 2006, at 3:06 PM, Roger Bivand wrote:

            
That was it Roger. Thanks. I was sure that I had the plugin  
installed, but after rebuilding gdal-withgrass and reinstalling,  
read.GDAL ran just fine.
#
On 19-Jan-06, at 16:30, Kirk R. Wythers wrote:

            
...
Great to hear that you got it working!

The procedure Roger was referring to for making everyone play  
correctly is slightly different, however, assuming I'm interpreting  
your message correctly.  So to make sure it's archived in the mailing  
list, here's what I've gathered is now the way to go (same idea for  
getting GRASS support fully functional in QGIS, by the way):

- build and install GDAL WITHOUT GRASS support
- build and install GRASS
- download the separate gdal-grass plugin that is available at the  
gdal site
(as of this writing, that's http://www.gdal.org/dl/gdal- 
grass-1.3.1.1.tar.gz )
and compile that, and the make install process in that directory will  
insert just
the GRASS driver into your existing GDAL tree

Then GDAL called from 3rd applications, e.g. R or QGIS, should be  
able to read GRASS rasters.

I don't know/can't remember whether this essentially does the same  
thing as what you did
(i.e. I'm assuming you've recompiled the full GDAL after GRASS with  
GRASS functionality turned on), or if there's a functional  
difference.  In any case, it's simpler, and is designed
to avoid circular dependency problems.

Cheers,
Scott Mitchell

----
Scott Mitchell, Assistant Professor, Carleton University
Department of Geography & Environmental Studies, Loeb A209
Mailing:  Loeb B349, 1125 Colonel By Dr., Ottawa, ON K1S 5B6 Canada
1-613-520-2600 x2695 Fax: 613-520-4301 Scott_Mitchell at carleton.ca
#
On Jan 20, 2006, at 12:13 PM, Scott Mitchell wrote:

            
Thanks Scott. I appreciate your desire to get the solution  
documented. Here are the details...
gdal-1.3.1

./configure
	--mandir=/usr/local/share/man
	--without-python
	--with-threads
	--with-static-proj4=/usr/local
	--with-libtiff=/usr/local
	--with-geotiff=/usr/local
	--with-jpeg=/usr/local
	--with-gif=/usr/local
	--with-png=/usr/local
	--with-jasper=/usr/local
	--with-pg=/usr/local/pgsql/bin/pg_config
	--with-mysql=/usr/local/mysql/bin/mysql_config
	--with-netcdf=/Volumes/disk1/home1/kwythers/src/netcdf-3.6.0-p1
	--with-hdf4=/Volumes/disk1/home1/kwythers/src/HDF4.2r1/hdf4-darwin
	--with-ogdi=/usr/local
	--with-geos=/usr/local/bin/geos-config
grass-6.1.cvs

./configure\
     --enable-64bit\
     --enable-sysv\
     --with-includes=/usr/X11R6/include\
     --with-libs=/usr/X11R6/lib\
     --with-freetype\
     --with-tcltk-includes=/usr/X11R6/include\
     --with-tcltk-libs=/usr/X11R6/lib\
     --with-gdal=/usr/local/bin/gdal-config\
     --with-proj\
     --with-x\
     --with-cxx\
     --with-glw\
     --with-motif\
     --without-odbc\
     --enable-shared\
     --with-postgres-includes=/usr/local/pgsql/include\
     --with-postgres-libs=/usr/local/pgsql/lib\
     --with-mysql\
     --with-mysql-includes=/usr/local/mysql/include\
     --with-mysql-libs=/usr/local/mysql/lib\
     --with-freetype-includes=/usr/local/include/freetype2
In my case I just reconfigured and re-installed gdal-1.3.1 with:

./configure
	--mandir=/usr/local/share/man
	--without-python
	--with-threads
	--with-static-proj4=/usr/local
	--with-libtiff=/usr/local
	--with-geotiff=/usr/local
	--with-jpeg=/usr/local
	--with-gif=/usr/local
	--with-png=/usr/local
	--with-jasper=/usr/local
	--with-pg=/usr/local/pgsql/bin/pg_config
	--with-mysql=/usr/local/mysql/bin/mysql_config
	--with-netcdf=/Volumes/disk1/home1/kwythers/src/netcdf-3.6.0-p1
	--with-hdf4=/Volumes/disk1/home1/kwythers/src/HDF4.2r1/hdf4-darwin
	--with-ogdi=/usr/local
	--with-geos=/usr/local/bin/geos-config
	--with-grass=/usr/local/grass-6.1.cvs
Perhaps this approach would be more efficient. I assume that http:// 
www.gdal.org/dl/gdal-grass-1.3.1.1.tar.gz  does not rebuild and  
reinstall whole gdal application?
I agree your approach would be simpler. Although since have not had  
any trouble getting qgis builds to read grass vectors or rasters, it  
would seem that both approaches work.
2 days later
#
On Fri, Jan 20, 2006 at 01:13:30PM -0500, Scott Mitchell wrote:
...
This is documented in the GRASS Wiki:

http://grass.gdf-hannover.de/twiki/bin/view/GRASS/WebHome
->  How to compile/install GRASS and QGIS with GDAL/OGR Plugin
    http://grass.gdf-hannover.de/twiki/bin/view/GRASS/GrassQgisGdalOgrPlugin


Best
 Markus