Compile and install GDAL-GRASS plugin: Difference between revisions
No edit summary |
(clarified) |
||
Line 35: | Line 35: | ||
==Troubleshooting== | ==Troubleshooting== | ||
All stuff installed but QGIS doesn't see GRASS or r.out.gdal doesn't work? | === All stuff installed but QGIS doesn't see GRASS or r.out.gdal doesn't work? === | ||
* Check if GDAL finds the plugin: | * Check if GDAL finds the plugin: | ||
Line 48: | Line 48: | ||
If not, create as root user the file "/etc/ld.so.conf.d/grass6.conf" with this line (modify path as needed): | If not, create as root user the file "/etc/ld.so.conf.d/grass6.conf" with this line (modify path as needed): | ||
/usr/grass-6.4. | /usr/grass-6.4.3/lib/ | ||
Then run "ldconfig" as root user. | Then run "ldconfig" as root user. | ||
=== Still failing ? === | |||
* Check if the GRASS plugins are in the right directory (check the 'Auto register' directory reported in the output): | * Check if the GRASS plugins are in the right directory (check the 'Auto register' directory reported in the output): | ||
Line 56: | Line 58: | ||
# remember that you have to specify the absolute path: | # remember that you have to specify the absolute path: | ||
export CPL_DEBUG=on | export CPL_DEBUG=on | ||
gdalinfo | gdalinfo $HOME/grassdata/spearfish60/PERMANENT/cellhd/roads | ||
ogrinfo -summary $HOME/grassdata/spearfish60/PERMANENT/vector/roads/head | ogrinfo -summary $HOME/grassdata/spearfish60/PERMANENT/vector/roads/head | ||
=== ERROR 1: libgrass_I.so: cannot open shared object file: No such file or directory === | |||
The path to "libgrass_I.so" is missing from LD_LIBRARY_PATH. To solve this, create as root user the file "/etc/ld.so.conf.d/grass6.conf" with this line (modify path as needed): | |||
/usr/grass-6.4.3/lib/ | |||
Then run "ldconfig" as root user. | |||
==Further Instructions== | ==Further Instructions== |
Revision as of 19:10, 8 October 2013
The idea of the GDAL-GRASS plugin is to directly access GRASS raster and vector data from outside. Any GDAL enabled software (QGIS, R, ...) can read and write through the plugin from the GRASS database. It is sufficient to indicate the full path to the GRASS dataset (see below).
The compilation order should be kept due to inter-dependencies between the packages. Please keep the order as seen below. GRASS compilation is explained in Compile and Install.
Compilation and Installation of Prerequisites
The install order should be kept due to inter-dependencies between the packages. Please keep the order or install all in a single step:
- PROJ4 with Datum grids file proj-datumgrid-1.X.zip (expand in nad/ before compiling)
- Optional: GEOS
- Optional: PostgreSQL, mySQL, unixODBC, SQLite (SQLite is needed for QGIS)
- GDAL/OGR compiled without GRASS support (because we use the plugin!)
Compilation and Installation of the GDAL-GRASS plugin
Get the GDAL/OGR-GRASS plugin - file: gdal-grass-1.4.3.tar.gz (or later)
- Use the latest plugin source code version available. The code is fairly stable so the version doesn't need to match the latest GDAL version to keep working. Generally if an update is needed it will be issued, otherwise the existing (well tested) version will be left in place.
- NOTE: the plugin needs to "see" the GRASS libraries. The best way is to add a file 'grass6.conf' into the directory /etc/ld.so.conf.d/ (edit as root) which contains the path to the GRASS libraries; then run 'ldconfig'. A script to configure/install easily can be found here.
For OSGeo4W, see http://download.osgeo.org/osgeo4w/release/grass/gdal-grass/
Usage of the plugin
You always need to specify the full path to the data set:
- GRASS raster map:
gdalinfo grassdata/spearfish60/PERMANENT/cellhd/aspect
- GRASS vector map:
ogrinfo -ro -so grassdata/spearfish60/PERMANENT/vector/roads/head
- Mapserver: should see both raster and vector maps, define connection properly in the .map file
- QGIS: only needs it for raster data
- OpenSceneGraph
Troubleshooting
All stuff installed but QGIS doesn't see GRASS or r.out.gdal doesn't work?
- Check if GDAL finds the plugin:
gdal_translate --formats | grep -i grass GRASS (ro): GRASS Database Rasters (5.7+)
- Check if the GRASS libs are found by the plugin. All libraries should be found (maybe you forgot to run 'ldconfig' if you didn't install from RPMs?):
ldd /usr/lib/gdalplugins/gdal_GRASS.so ldd /usr/lib/gdalplugins/ogr_GRASS.so
If not, create as root user the file "/etc/ld.so.conf.d/grass6.conf" with this line (modify path as needed):
/usr/grass-6.4.3/lib/
Then run "ldconfig" as root user.
Still failing ?
- Check if the GRASS plugins are in the right directory (check the 'Auto register' directory reported in the output):
# remember that you have to specify the absolute path: export CPL_DEBUG=on gdalinfo $HOME/grassdata/spearfish60/PERMANENT/cellhd/roads ogrinfo -summary $HOME/grassdata/spearfish60/PERMANENT/vector/roads/head
The path to "libgrass_I.so" is missing from LD_LIBRARY_PATH. To solve this, create as root user the file "/etc/ld.so.conf.d/grass6.conf" with this line (modify path as needed):
/usr/grass-6.4.3/lib/
Then run "ldconfig" as root user.
Further Instructions
If you are still having trouble, please also visit "GRASS for Fedora Core 4" for more detailed GRASS and GDAL compilation and installation instructions developed by Isaac Ullah for Fedora Core 4.
There are good instructions on source code compiling here http://casoilresource.lawr.ucdavis.edu/drupal/node/123