[Qgis-user] Using processing algorithms from the console in QGIS 3.0

Stephen Bosch posting at vodacomm.ca
Wed Mar 21 09:46:55 PDT 2018


Hello,

I am running QGIS 3.0.0 in Linux.

I'm trying to migrate some pyqgis code from 2.14 to 3.0 and discovering the
hard way that just about everything has changed :)

(Unfortunately, the docs haven't been updated yet and the API docs are
pretty sparse.)

Say I have this command, which worked in 2.x:

file_grid_r = processing.runalg("grass7:v.to.rast.value", grid_v, 0, 1,
extent, 0.008333, -1, 0.000100, None)['output']

processing.runalg() doesn't exist anymore, apparently it was replaced with
processing.run(). However, this:

file_grid_r = processing.run("grass7:v.to.rast.value", grid_v, 0, 1,
extent, 0.008333, -1, 0.000100, None)['output']

does not work as expected. In the PyCharm debugger, I receive this error
message:

sys:1: ResourceWarning: unclosed <socket.socket fd=3,
family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0,
laddr=('127.0.0.1', 50386), raddr=('127.0.0.1', 40183)>

(If the command syntax is in fact correct, then perhaps the algorithm is
not accessible?)

My questions:

   - Is there up-to-date console documentation for the Processing toolbox
   somewhere?
   - How can I get a listing of the available algorithms in the same format
   as in 2.x?
   - How do I convert the algorithm calls (processing.runalg) from 2.x to
   3.x?


Thanks

Stephen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20180321/29d097fe/attachment.html>


More information about the Qgis-user mailing list