[Qgis-developer] processing.runalg() issue with grass algorithms
egoddard1010 at gmail.com
Sat Mar 22 10:47:30 PDT 2014
Still having issues with processing, QGIS master (942d5da) compiled
today. I have a script I wrote for GRASS that i'm trying to port over
to QGIS. I'm testing the first step to make sure it is going to work
before I write the whole thing; it consists of:
2 ##radius=number 4
3 ##lrm=output raster
5 lpf = processing.runalg("saga:simplefilter", dem, 0, 0, radius, None)
If I run this script, I get the following error:
Oooops! The following output layers could not be open
The above files could not be opened, which probably indicates that
they were not correctly produced by the executed algorithm
Checking the log information might help you see why those layers were
not created as expected
The Log contains:
Algorithm local relief starting...
Loading resulting layers
Algorithm local relief finished
If I run the same line in the python console, it works correctly:
>>> radius = 4
>>> lpf = processing.runalg("saga:simplefilter", "SR_50M_alaska_nad", 0, 0, radius, None)
Results in the map being loaded.
Also, if I change the output folder in the processing settings to a
different location (in this case, tmp/processing in my home folder)
and run another algorithm in the python console, the RESULT key still
points to /tmp/processing/...
Any pointers on why the script doesn't run would be appreciated. I
didn't see an existing issue on hub.qgis.org regarding the output
folder issue, so it might be a new bug...
On Sun, Mar 16, 2014 at 1:21 AM, Eric Goddard <egoddard1010 at gmail.com> wrote:
> Hi all,
> I'm using QGIS 2.3-Master 64-bit, fa157b0 with GRASS 6.4.4svn on linux.
> When I pass a grass command to processing.runalg() without specifying
> the GRASS_REGION_PARAMETER or GRASS_REGION_CELLSIZE_PARAMETER, I get
> an empty output because the region/cell size are invalid. For example,
> using the qgis sample data, if I run:
> lpf = processing.runalg("grass:r.neighbors", "SR_50M_alaska_nad", 0,
> 9, False, False, None, None, None, None)
> there is an output key in lpf that points to a tif, but that tif
> doesnt exist. Looking at the log, the above command is translated to:
> If one runs the r.neighbors algorithm from the Processing Toolbox,
> leaving the region and cell size at the defaults (blank and 0.00)
> works correctly. How can a similar behavior be achieved when running
> the command through processing.runalg()?
> And on a somewhat related note, when running a grass algorithm from
> the toolbox there is an option to select extent on canvas--can this be
> used in custom processing scripts?
More information about the Qgis-developer