I am using qgis 2.4 and i am looking for the "easiest" way to execute e.g. the r.in.gdal function from the python console in qgis.
Specifically for r.in.gdal, I could not found this function in processing module (i.e. import processing; processing.alglist('r.in')), thus, processing module seems not to be the way to go ?!?
Before executing a grass command the mapset needs to be opened. Which command does this job?
1 Answer 1
r.in.gdal is a command to import rasters into GRASS GIS, not into QGIS
There are two options to use GRASS GIS in QGIS:
1) with the grass plugin
- you are working in GRASS GIS and you can use
r.in.gdal
in the Python console of GRASS GIS to import a raster into a Location/Mapset.
2) from processing
- you are working in QGIS with a "virtual" Location/Mapset that has nothing to do with the Location/Mapset of 1), therefore
r.in.gdal
is useless -> use the the PyQGIS solution in the Python console of QGIS
You can also use osgeo.gdal to import a raster into a GRASS GIS Location/Mapset.