Hi list !<br><br>I'd like to know who has coded the grass support for QGIS. Are you here ? Does anybody know ?<br>My goal is to contact them to get more information about the way qgsgrass.cpp, qgsgrassmodule.cpp, qgsgrassshell.cpp ....<br>
In fact i'm trying to parse this C++ code into python from quite a long time ago, in the aim to be abble to call grasstools from any external QGIS python plugin.<br>I understands i have to use Qprocess like in the C++, and also to set up the grass environment / variables in my python code.<br>
<br>I've tested several methods to to the job, but it still fails.<br><br>For example, i'm trying to call r.stats command from the rxvt shell with the following code:<br>( i want to get the raster cells values written in a txt file)<br>
******************************************************************************************************<br> <span style="font-style: italic;">process = QProcess()</span><br style="font-style: italic;"><span style="font-style: italic;"> exe =QString("rxvt.exe")</span><br style="font-style: italic;">
<span style="font-style: italic;"> arg=QStringList("r.stats -1gn input=mnt10m output='C:/test' fs=;");</span><br style="font-style: italic;"><span style="font-style: italic;"> arg.append("@ARGS_PARSED@")</span><br style="font-style: italic;">
<span style="font-style: italic;"> env = process.systemEnvironment()</span><br style="font-style: italic;"><span style="font-style: italic;"> env.append("$GISDBASE='D:/DATA';")</span><br style="font-style: italic;">
<span style="font-style: italic;"> env.append("$LOCATION_NAME='neff';")</span><br style="font-style: italic;"><span style="font-style: italic;"> env.append("$MAPSET='neffmap';")</span><br style="font-style: italic;">
<span style="font-style: italic;"> process.setEnvironment(env)</span><br style="font-style: italic;"><span style="font-style: italic;"> process.start(exe,arg)<br><br>********************************************************************************************************<br>
</span>This code snippet doesn't work (the txt file isn't created) but i got no python errors and no QGIS crash so i think i'm just missing something important<br>That's why i'd really enjoy being in contact with Qgrass developers, to know what's going wrong<br>
Or may be someone with good knowledge of the QGIS API and Python knows how to do the trick ???<br><br>Any hints, help or advices would be really appreciated<br>Thanks<br><br>PikO<br><br><br><span style="font-style: italic;"></span>