Processing: QGIS Crash with new processing script format, QGIS 3.6.1 Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?QGIS processing script: No raster output from gdalogr:translate and gdalogr:cliprasterbyextentMissing the results from grass tools when used in python consolespurious “.tif Exists” errors on QGIS Python script processingQGIS running processing algorithm in Python Console does not store Outputfile?Piping custom processing algorithm output into another in QGIS?Output layer from PyQGIS 3 processing script is emptyDEM File “not found” Error when running r.watershed with Processing Toolbox in QGIS 3.4.2 with GRASSUsing parameterAsSink in QGIS processing script?SAGA Raster Calculator in QGIS Algorithm script produces 'NoneType' object has no attribute 'crs'Returning a new vector layer with additional setup from a processing algorithm in QGIS 3
AppleTVs create a chatty alternate WiFi network
Why are my pictures showing a dark band on one edge?
How does light 'choose' between wave and particle behaviour?
What does it mean that physics no longer uses mechanical models to describe phenomena?
Do wooden building fires get hotter than 600°C?
Is CEO the "profession" with the most psychopaths?
Lagrange four-squares theorem --- deterministic complexity
What does 丫 mean? 丫是什么意思?
How would a mousetrap for use in space work?
What is an "asse" in Elizabethan English?
Central Vacuuming: Is it worth it, and how does it compare to normal vacuuming?
Would it be easier to apply for a UK visa if there is a host family to sponsor for you in going there?
How to identify unknown coordinate type and convert to lat/lon?
Why does it sometimes sound good to play a grace note as a lead in to a note in a melody?
How often does castling occur in grandmaster games?
What's the point of the test set?
Electrolysis of water: Which equations to use? (IB Chem)
What makes a man succeed?
How much damage would a cupful of neutron star matter do to the Earth?
Did any compiler fully use 80-bit floating point?
Should a wizard buy fine inks every time he want to copy spells into his spellbook?
1-probability to calculate two events in a row
Can the Flaming Sphere spell be rammed into multiple Tiny creatures that are in the same 5-foot square?
Did Mueller's report provide an evidentiary basis for the claim of Russian govt election interference via social media?
Processing: QGIS Crash with new processing script format, QGIS 3.6.1
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?QGIS processing script: No raster output from gdalogr:translate and gdalogr:cliprasterbyextentMissing the results from grass tools when used in python consolespurious “.tif Exists” errors on QGIS Python script processingQGIS running processing algorithm in Python Console does not store Outputfile?Piping custom processing algorithm output into another in QGIS?Output layer from PyQGIS 3 processing script is emptyDEM File “not found” Error when running r.watershed with Processing Toolbox in QGIS 3.4.2 with GRASSUsing parameterAsSink in QGIS processing script?SAGA Raster Calculator in QGIS Algorithm script produces 'NoneType' object has no attribute 'crs'Returning a new vector layer with additional setup from a processing algorithm in QGIS 3
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I've just started to use the new (3.6.1) processing script format (see https://github.com/qgis/QGIS-Enhancement-Proposals/issues/134 or https://anitagraser.com/2019/03/02/easy-processing-scripts-comeback-in-qgis-3-6/) and tried to put 2 processing algorithmen in it (centroid and buffer), but without success. The script stopped with a :( QGIS crashed. May be someone can help me to get the right idea to connect various processing steps within the new format. Here is my script:
from qgis.processing import alg
import processing
@alg(name="centroids_and_buffer", label=alg.tr("Centroids and buffer"), group="examplescripts", group_label=alg.tr("Example Scripts"))
@alg.input(type=alg.SOURCE, name="INPUT", label="Input layer")
@alg.input(type=alg.SINK, name="OUTPUT", label="Output layer")
def testalg(instance, parameters, context, feedback, inputs):
"""
Description goes here. (Don't delete this! Removing this comment will cause errors.)
"""
source = instance.parameterAsVectorLayer(parameters, "INPUT", context)
output = instance.parameterAsOutputLayer(parameters, "OUTPUT", context)
centroids = processing.run("native:centroids", 'INPUT': source,'ALL_PARTS': True, 'OUTPUT': 'memory:')
#now the buffer
alg_params = 'DISSOLVE': False,
'DISTANCE': 0.001,
'END_CAP_STYLE': 0,
'INPUT': centroids['OUTPUT'],
'JOIN_STYLE': 0,
'MITER_LIMIT': 2,
'SEGMENTS': 5,
'OUTPUT': 'memory:'
buffer= processing.run("native:buffer", alg_params)
print(buffer['OUTPUT'])
#output = buffer['OUTPUT']
return "OUTPUT": buffer['OUTPUT']
qgis pyqgis qgis-processing
add a comment |
I've just started to use the new (3.6.1) processing script format (see https://github.com/qgis/QGIS-Enhancement-Proposals/issues/134 or https://anitagraser.com/2019/03/02/easy-processing-scripts-comeback-in-qgis-3-6/) and tried to put 2 processing algorithmen in it (centroid and buffer), but without success. The script stopped with a :( QGIS crashed. May be someone can help me to get the right idea to connect various processing steps within the new format. Here is my script:
from qgis.processing import alg
import processing
@alg(name="centroids_and_buffer", label=alg.tr("Centroids and buffer"), group="examplescripts", group_label=alg.tr("Example Scripts"))
@alg.input(type=alg.SOURCE, name="INPUT", label="Input layer")
@alg.input(type=alg.SINK, name="OUTPUT", label="Output layer")
def testalg(instance, parameters, context, feedback, inputs):
"""
Description goes here. (Don't delete this! Removing this comment will cause errors.)
"""
source = instance.parameterAsVectorLayer(parameters, "INPUT", context)
output = instance.parameterAsOutputLayer(parameters, "OUTPUT", context)
centroids = processing.run("native:centroids", 'INPUT': source,'ALL_PARTS': True, 'OUTPUT': 'memory:')
#now the buffer
alg_params = 'DISSOLVE': False,
'DISTANCE': 0.001,
'END_CAP_STYLE': 0,
'INPUT': centroids['OUTPUT'],
'JOIN_STYLE': 0,
'MITER_LIMIT': 2,
'SEGMENTS': 5,
'OUTPUT': 'memory:'
buffer= processing.run("native:buffer", alg_params)
print(buffer['OUTPUT'])
#output = buffer['OUTPUT']
return "OUTPUT": buffer['OUTPUT']
qgis pyqgis qgis-processing
Try removeprint(buffer['OUTPUT'])
. Usingprint()
from scripts tends to crash QGIS 3.
– Joseph
Apr 12 at 11:09
Thanks Joseph, but it is still crashing.
– eurojam
Apr 12 at 12:13
add a comment |
I've just started to use the new (3.6.1) processing script format (see https://github.com/qgis/QGIS-Enhancement-Proposals/issues/134 or https://anitagraser.com/2019/03/02/easy-processing-scripts-comeback-in-qgis-3-6/) and tried to put 2 processing algorithmen in it (centroid and buffer), but without success. The script stopped with a :( QGIS crashed. May be someone can help me to get the right idea to connect various processing steps within the new format. Here is my script:
from qgis.processing import alg
import processing
@alg(name="centroids_and_buffer", label=alg.tr("Centroids and buffer"), group="examplescripts", group_label=alg.tr("Example Scripts"))
@alg.input(type=alg.SOURCE, name="INPUT", label="Input layer")
@alg.input(type=alg.SINK, name="OUTPUT", label="Output layer")
def testalg(instance, parameters, context, feedback, inputs):
"""
Description goes here. (Don't delete this! Removing this comment will cause errors.)
"""
source = instance.parameterAsVectorLayer(parameters, "INPUT", context)
output = instance.parameterAsOutputLayer(parameters, "OUTPUT", context)
centroids = processing.run("native:centroids", 'INPUT': source,'ALL_PARTS': True, 'OUTPUT': 'memory:')
#now the buffer
alg_params = 'DISSOLVE': False,
'DISTANCE': 0.001,
'END_CAP_STYLE': 0,
'INPUT': centroids['OUTPUT'],
'JOIN_STYLE': 0,
'MITER_LIMIT': 2,
'SEGMENTS': 5,
'OUTPUT': 'memory:'
buffer= processing.run("native:buffer", alg_params)
print(buffer['OUTPUT'])
#output = buffer['OUTPUT']
return "OUTPUT": buffer['OUTPUT']
qgis pyqgis qgis-processing
I've just started to use the new (3.6.1) processing script format (see https://github.com/qgis/QGIS-Enhancement-Proposals/issues/134 or https://anitagraser.com/2019/03/02/easy-processing-scripts-comeback-in-qgis-3-6/) and tried to put 2 processing algorithmen in it (centroid and buffer), but without success. The script stopped with a :( QGIS crashed. May be someone can help me to get the right idea to connect various processing steps within the new format. Here is my script:
from qgis.processing import alg
import processing
@alg(name="centroids_and_buffer", label=alg.tr("Centroids and buffer"), group="examplescripts", group_label=alg.tr("Example Scripts"))
@alg.input(type=alg.SOURCE, name="INPUT", label="Input layer")
@alg.input(type=alg.SINK, name="OUTPUT", label="Output layer")
def testalg(instance, parameters, context, feedback, inputs):
"""
Description goes here. (Don't delete this! Removing this comment will cause errors.)
"""
source = instance.parameterAsVectorLayer(parameters, "INPUT", context)
output = instance.parameterAsOutputLayer(parameters, "OUTPUT", context)
centroids = processing.run("native:centroids", 'INPUT': source,'ALL_PARTS': True, 'OUTPUT': 'memory:')
#now the buffer
alg_params = 'DISSOLVE': False,
'DISTANCE': 0.001,
'END_CAP_STYLE': 0,
'INPUT': centroids['OUTPUT'],
'JOIN_STYLE': 0,
'MITER_LIMIT': 2,
'SEGMENTS': 5,
'OUTPUT': 'memory:'
buffer= processing.run("native:buffer", alg_params)
print(buffer['OUTPUT'])
#output = buffer['OUTPUT']
return "OUTPUT": buffer['OUTPUT']
qgis pyqgis qgis-processing
qgis pyqgis qgis-processing
edited Apr 11 at 20:28
eurojam
asked Apr 11 at 15:46
eurojameurojam
1,106312
1,106312
Try removeprint(buffer['OUTPUT'])
. Usingprint()
from scripts tends to crash QGIS 3.
– Joseph
Apr 12 at 11:09
Thanks Joseph, but it is still crashing.
– eurojam
Apr 12 at 12:13
add a comment |
Try removeprint(buffer['OUTPUT'])
. Usingprint()
from scripts tends to crash QGIS 3.
– Joseph
Apr 12 at 11:09
Thanks Joseph, but it is still crashing.
– eurojam
Apr 12 at 12:13
Try remove
print(buffer['OUTPUT'])
. Using print()
from scripts tends to crash QGIS 3.– Joseph
Apr 12 at 11:09
Try remove
print(buffer['OUTPUT'])
. Using print()
from scripts tends to crash QGIS 3.– Joseph
Apr 12 at 11:09
Thanks Joseph, but it is still crashing.
– eurojam
Apr 12 at 12:13
Thanks Joseph, but it is still crashing.
– eurojam
Apr 12 at 12:13
add a comment |
1 Answer
1
active
oldest
votes
Thanks to the qgis-user@lists.osgeo.org I could solve the problem. There is a brief description how to proceed with the new @alg decorator at: https://docs.qgis.org/testing/en/docs/user_manual/processing/scripts.html#the-alg-decorator. Finally the script looks like this:
from qgis.processing import alg
import processing
@alg(name="centroids_and_buffer", label=alg.tr("Centroids and buffer"), group="examplescripts", group_label=alg.tr("Example Scripts"))
@alg.input(type=alg.SOURCE, name="INPUT", label="Input layer")
@alg.input(type=alg.VECTOR_LAYER_DEST, name='BUFFER_OUTPUT', label='Buffer output')
def centroids_and_buffer(instance, parameters, context, feedback, inputs):
"""
Description goes here. (Don't delete this! Removing this comment will cause errors.)
"""
source = instance.parameterAsVectorLayer(parameters, "INPUT", context)
if feedback.isCanceled():
return
centroids = processing.run("native:centroids",
'INPUT': parameters['INPUT'],
'ALL_PARTS': True,
'OUTPUT': 'memory:',
is_child_algorithm=True,
context=context,
feedback=feedback)
if feedback.isCanceled():
return
alg_params = 'DISSOLVE': False,
'DISTANCE': 0.01,
'END_CAP_STYLE': 0,
'INPUT': centroids['OUTPUT'],
'JOIN_STYLE': 0,
'MITER_LIMIT': 2,
'SEGMENTS': 5,
'OUTPUT': parameters['BUFFER_OUTPUT']
buffer = processing.run("native:buffer", alg_params,
is_child_algorithm=True,
context=context,
feedback=feedback)
if feedback.isCanceled():
return
return 'BUFFER_OUTPUT': buffer['OUTPUT']
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "79"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f318515%2fprocessing-qgis-crash-with-new-processing-script-format-qgis-3-6-1%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks to the qgis-user@lists.osgeo.org I could solve the problem. There is a brief description how to proceed with the new @alg decorator at: https://docs.qgis.org/testing/en/docs/user_manual/processing/scripts.html#the-alg-decorator. Finally the script looks like this:
from qgis.processing import alg
import processing
@alg(name="centroids_and_buffer", label=alg.tr("Centroids and buffer"), group="examplescripts", group_label=alg.tr("Example Scripts"))
@alg.input(type=alg.SOURCE, name="INPUT", label="Input layer")
@alg.input(type=alg.VECTOR_LAYER_DEST, name='BUFFER_OUTPUT', label='Buffer output')
def centroids_and_buffer(instance, parameters, context, feedback, inputs):
"""
Description goes here. (Don't delete this! Removing this comment will cause errors.)
"""
source = instance.parameterAsVectorLayer(parameters, "INPUT", context)
if feedback.isCanceled():
return
centroids = processing.run("native:centroids",
'INPUT': parameters['INPUT'],
'ALL_PARTS': True,
'OUTPUT': 'memory:',
is_child_algorithm=True,
context=context,
feedback=feedback)
if feedback.isCanceled():
return
alg_params = 'DISSOLVE': False,
'DISTANCE': 0.01,
'END_CAP_STYLE': 0,
'INPUT': centroids['OUTPUT'],
'JOIN_STYLE': 0,
'MITER_LIMIT': 2,
'SEGMENTS': 5,
'OUTPUT': parameters['BUFFER_OUTPUT']
buffer = processing.run("native:buffer", alg_params,
is_child_algorithm=True,
context=context,
feedback=feedback)
if feedback.isCanceled():
return
return 'BUFFER_OUTPUT': buffer['OUTPUT']
add a comment |
Thanks to the qgis-user@lists.osgeo.org I could solve the problem. There is a brief description how to proceed with the new @alg decorator at: https://docs.qgis.org/testing/en/docs/user_manual/processing/scripts.html#the-alg-decorator. Finally the script looks like this:
from qgis.processing import alg
import processing
@alg(name="centroids_and_buffer", label=alg.tr("Centroids and buffer"), group="examplescripts", group_label=alg.tr("Example Scripts"))
@alg.input(type=alg.SOURCE, name="INPUT", label="Input layer")
@alg.input(type=alg.VECTOR_LAYER_DEST, name='BUFFER_OUTPUT', label='Buffer output')
def centroids_and_buffer(instance, parameters, context, feedback, inputs):
"""
Description goes here. (Don't delete this! Removing this comment will cause errors.)
"""
source = instance.parameterAsVectorLayer(parameters, "INPUT", context)
if feedback.isCanceled():
return
centroids = processing.run("native:centroids",
'INPUT': parameters['INPUT'],
'ALL_PARTS': True,
'OUTPUT': 'memory:',
is_child_algorithm=True,
context=context,
feedback=feedback)
if feedback.isCanceled():
return
alg_params = 'DISSOLVE': False,
'DISTANCE': 0.01,
'END_CAP_STYLE': 0,
'INPUT': centroids['OUTPUT'],
'JOIN_STYLE': 0,
'MITER_LIMIT': 2,
'SEGMENTS': 5,
'OUTPUT': parameters['BUFFER_OUTPUT']
buffer = processing.run("native:buffer", alg_params,
is_child_algorithm=True,
context=context,
feedback=feedback)
if feedback.isCanceled():
return
return 'BUFFER_OUTPUT': buffer['OUTPUT']
add a comment |
Thanks to the qgis-user@lists.osgeo.org I could solve the problem. There is a brief description how to proceed with the new @alg decorator at: https://docs.qgis.org/testing/en/docs/user_manual/processing/scripts.html#the-alg-decorator. Finally the script looks like this:
from qgis.processing import alg
import processing
@alg(name="centroids_and_buffer", label=alg.tr("Centroids and buffer"), group="examplescripts", group_label=alg.tr("Example Scripts"))
@alg.input(type=alg.SOURCE, name="INPUT", label="Input layer")
@alg.input(type=alg.VECTOR_LAYER_DEST, name='BUFFER_OUTPUT', label='Buffer output')
def centroids_and_buffer(instance, parameters, context, feedback, inputs):
"""
Description goes here. (Don't delete this! Removing this comment will cause errors.)
"""
source = instance.parameterAsVectorLayer(parameters, "INPUT", context)
if feedback.isCanceled():
return
centroids = processing.run("native:centroids",
'INPUT': parameters['INPUT'],
'ALL_PARTS': True,
'OUTPUT': 'memory:',
is_child_algorithm=True,
context=context,
feedback=feedback)
if feedback.isCanceled():
return
alg_params = 'DISSOLVE': False,
'DISTANCE': 0.01,
'END_CAP_STYLE': 0,
'INPUT': centroids['OUTPUT'],
'JOIN_STYLE': 0,
'MITER_LIMIT': 2,
'SEGMENTS': 5,
'OUTPUT': parameters['BUFFER_OUTPUT']
buffer = processing.run("native:buffer", alg_params,
is_child_algorithm=True,
context=context,
feedback=feedback)
if feedback.isCanceled():
return
return 'BUFFER_OUTPUT': buffer['OUTPUT']
Thanks to the qgis-user@lists.osgeo.org I could solve the problem. There is a brief description how to proceed with the new @alg decorator at: https://docs.qgis.org/testing/en/docs/user_manual/processing/scripts.html#the-alg-decorator. Finally the script looks like this:
from qgis.processing import alg
import processing
@alg(name="centroids_and_buffer", label=alg.tr("Centroids and buffer"), group="examplescripts", group_label=alg.tr("Example Scripts"))
@alg.input(type=alg.SOURCE, name="INPUT", label="Input layer")
@alg.input(type=alg.VECTOR_LAYER_DEST, name='BUFFER_OUTPUT', label='Buffer output')
def centroids_and_buffer(instance, parameters, context, feedback, inputs):
"""
Description goes here. (Don't delete this! Removing this comment will cause errors.)
"""
source = instance.parameterAsVectorLayer(parameters, "INPUT", context)
if feedback.isCanceled():
return
centroids = processing.run("native:centroids",
'INPUT': parameters['INPUT'],
'ALL_PARTS': True,
'OUTPUT': 'memory:',
is_child_algorithm=True,
context=context,
feedback=feedback)
if feedback.isCanceled():
return
alg_params = 'DISSOLVE': False,
'DISTANCE': 0.01,
'END_CAP_STYLE': 0,
'INPUT': centroids['OUTPUT'],
'JOIN_STYLE': 0,
'MITER_LIMIT': 2,
'SEGMENTS': 5,
'OUTPUT': parameters['BUFFER_OUTPUT']
buffer = processing.run("native:buffer", alg_params,
is_child_algorithm=True,
context=context,
feedback=feedback)
if feedback.isCanceled():
return
return 'BUFFER_OUTPUT': buffer['OUTPUT']
answered Apr 12 at 14:56
eurojameurojam
1,106312
1,106312
add a comment |
add a comment |
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f318515%2fprocessing-qgis-crash-with-new-processing-script-format-qgis-3-6-1%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Try remove
print(buffer['OUTPUT'])
. Usingprint()
from scripts tends to crash QGIS 3.– Joseph
Apr 12 at 11:09
Thanks Joseph, but it is still crashing.
– eurojam
Apr 12 at 12:13