-
-
Notifications
You must be signed in to change notification settings - Fork 669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify and adjust use of runAndLoadResults method #9068
Conversation
Or, after you ran the pasted command, and depending on the output layer type, you can type e.g.:: | ||
|
||
Otherwise, you can use:: | ||
|
||
processing.runAndloadResults | ||
iface.addVectorLayer('/path/to/output/filename', 'Layer name in legend', 'ogr') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The manual mentions the use of a load() method but I can't find it nor figure out how it would work. Should probably be suggested here. So if anyone knows...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nyalldawson can you show how the load() method can be used here, please? Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That load method is deprecated, we shouldn't mention it: https://github.com/qgis/QGIS/blob/master/python/plugins/processing/tools/dataobjects.py#L111
(it won't work as desired anyway)
If you want to do it by hand you'd do something like:
results = processing.run("native:buffer", {'INPUT':'/home/nyall/dev/QGIS/tests/testdata/points.shp','DISTANCE':10,'SEGMENTS':5,'END_CAP_STYLE':0,'JOIN_STYLE':0,'MITER_LIMIT':2,'DISSOLVE':False,'SEPARATE_DISJOINT':False,'OUTPUT':'TEMPORARY_OUTPUT'})
buffered_layer = results['OUTPUT']
QgsProject.instance().addMapLayer(buffered_layer)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @nyalldawson
Goal:
Ticket(s): #