Bug#858251: qgis: no access to grass7 algorithms from toolbox

Moritz Lennert mlennert at club.worldonline.be
Tue Mar 21 10:17:55 UTC 2017


On 20/03/17 18:28, Sebastiaan Couwenberg wrote:
> Control: tags -1 moreinfo
>
> On 03/20/2017 12:44 PM, Moritz Lennert wrote:
>> In QGIS 2.14.11 (but it seems this has been the case before), one cannot
>> launch any of the GRASS7 algorithms from the processing toolbox.
>>
>> The issue is known and apparently corrected in Master: https://hub.qgis.org/issues/13072.
>>
>> Would it be possible to cherry pick relevant parts of the fix to make it
>> work in 2.14 ? Especially since a release date for a new LTS version is
>> not fixed, yet ?
>
> The fix linked in that issue [0] is already included in QGIS 2.14.11
> (and earlier).

Yes, sorry, I didn't do my homework correctly on this one.

>
> The issue seems to suggest that you should be using the GRASS 7 plugin
> instead of the processing algorithms since the qgis package is built
> with GRASS support and doesn't need to rely on external tools.

I don't really read the discussions in that issue as meaning that you 
should use the plugin instead of processing.

However, I think I found the culprit:

In

/usr/share/qgis/python/plugins/processing/algs/grass7/Grass7Utils.py

line 254 has:

command = 'grass70 ' + Grass7Utils.grassMapsetFolder() \

changing this to

  command = 'grass72 ' + Grass7Utils.grassMapsetFolder() \

or (probably even better) to

  command = 'grass ' + Grass7Utils.grassMapsetFolder() \

Solves the issue for me.

Other places that might need change to 7.2 :

line 80 (getGrassVersion()):
         return '7.0.0'

(ideally this should probably rather call 'grass -v' to get its version)

line 420 (grassHelpPath()):
	return helpPath if helpPath is not None else 	
		'http://grass.osgeo.org/grass70/manuals/'

(command API should have staid more or less the same between 7.0 and 
7.2, but there might have been slight changes)

Changing line 254 to 'grass' and the other two to '7.2.0' and 'grass72' 
respectively makes GRASS7 processing work for me.

>
> Doesn't the GRASS plugin do what you need?

No, it's a different approach. The GRASS plugin allows you to access a 
GRASS GISDBASE and locations. This means you have to set those up.

Processing allows you to use GRASS algorithms directly any layer you 
currently have in your project without having to create a GISDBASE and 
relevant locations.
Personally, I don't have any need for the plugin (I rather use GRASS 
directly), but I find the processing approach very useful, especially 
for teaching.

But in any case, the user shouldn't have to choose between the two.

Moritz



More information about the Pkg-grass-devel mailing list