Unable to load output layer from Python algorithm in QGIS 3Different output from running algorithm in toolbox...

two subject complements in passive form?

How can I give a Ranger advantage on a check due to Favored Enemy without spoiling the story for the player?

Isn't a semicolon (';') needed after a function declaration in C++?

Is practicing on a digital piano harmful to an experienced piano player?

How do I avoid the "chosen hero" feeling?

Is having explosions as a go-to solution considered bad table manners?

What is an efficient way to digitize a family photo collection?

Is it possible to methodically find the total of ways to read a given phrase making a stack?

Was Opportunity's last message to Earth "My battery is low and it's getting dark"?

Tikz: Perpendicular FROM a line

Where should we use pstVerb?

Is Screenshot Time-tracking Common?

Confused about cosec(x).

How do I fight with Heavy Armor as a Wizard with Tenser's Transformation?

Why can't I set the 'prototype' of a function created using 'bind'?

Taking an academic pseudonym?

Crack the bank account's password!

How can guns be countered by melee combat without raw-ability or exceptional explanations?

What is formjacking?

How many diagrams is too much in a research article?

How can I prevent an oracle who can see into the past from knowing everything that has happened?

How to deal with an underperforming subordinate?

How can I handle players killing my NPC outside of combat?

How do I narratively explain how in-game circumstances do not mechanically allow a PC to instantly kill an NPC?



Unable to load output layer from Python algorithm in QGIS 3


Different output from running algorithm in toolbox and from scriptUsing processing using other output (result from another algorithm) as inputProcessing algorithm fails from Python scriptQGIS Processing Input CRS from Input LayerGetting the output layer using any processing.run*(…) method?Piping custom processing algorithm output into another in QGIS?Piping output of one processing algorithm as input into another algorithm in QGIS Processing script?Error Heatmap plugin QGIS 3.2.0Access string output of QGIS 3 processing script in graphical modelerOutput layer from PyQGIS 3 processing script is empty













1















I'm building a Python algorithm for QGIS 3, to be run from the Processing Toolbox. I've finished debugging the algorithm body, which seems to work, but QGIS is unable to load its output.



To summarize, the algorithm generates a vector layer in memory, sets up a QgsHeatmapRenderer object with some desired parameters, and sets this as the layer's renderer. It works correctly, but QGIS is somehow unable to deal with the result.



Here's the algorithm code (also available on GitHub):



# -*- coding: utf-8 -*-

# Create a heatmap of a single route, based on data from the OpenRouteService
# API. This is a proof-of-concept script only.

from PyQt5.QtCore import QCoreApplication
from PyQt5.QtGui import QColor
from qgis.core import *
import processing
import openrouteservice

# Define variables as necessary
# Here
failures = 0

# Create necessary functions
# Here

class MyProcessingAlgorithm(QgsProcessingAlgorithm):
"""
This algorithm creates a heatmap of a single route, based on data from the
OpenRouteService API. This is a proof-of-concept script only.
"""

# Constants used to refer to parameters and outputs. They will be
# used when calling the algorithm from another algorithm, or when
# calling from the QGIS console.

INPUT = 'INPUT'
OUTPUT = 'OUTPUT'

def tr(self, string):
"""
Returns a translatable string with the self.tr() function.
"""
return QCoreApplication.translate('Processing', string)

def createInstance(self):
return MyProcessingAlgorithm()

def name(self):
"""
Returns the algorithm name, used for identifying the algorithm. This
string should be fixed for the algorithm, and must not be localised.
The name should be unique within each provider. Names should contain
lowercase alphanumeric characters only and no spaces or other
formatting characters.
"""
return 'singlepathheatmap'

def displayName(self):
"""
Returns the translated algorithm name, which should be used for any
user-visible display of the algorithm name.
"""
return self.tr('Single Path Heatmap')

def group(self):
"""
Returns the name of the group this algorithm belongs to. This string
should be localised.
"""
return self.tr('Science Fair 2019')

def groupId(self):
"""
Returns the unique ID of the group this algorithm belongs to. This
string should be fixed for the algorithm, and must not be localised.
The group id should be unique within each provider. Group id should
contain lowercase alphanumeric characters only and no spaces or other
formatting characters.
"""
return 'sciencefairtwentynineteen'

def shortHelpString(self):
"""
Returns a localised short helper string for the algorithm. This string
should provide a basic description about what the algorithm does and the
parameters and outputs associated with it.
"""
return self.tr("This script creates a heatmap of a single route,
based on data from the OpenRouteService API. This is
a proof-of-concept script only.")

def initAlgorithm(self, config=None):
"""
Define the inputs and output of the algorithm, along with some other
properties.
"""

# Add a text input for the user's OpenRouteService API key.
self.addParameter(
QgsProcessingParameterString(
self.INPUT,
self.tr('Your OpenRouteService API Key')
)
)

# Add a feature sink in which to store our processed features (this
# usually takes the form of a newly created vector layer when the
# algorithm is run in QGIS).
self.addParameter(
QgsProcessingParameterFeatureSink(
self.OUTPUT,
self.tr('Heatmap Layer')
)
)

def processAlgorithm(self, parameters, context, feedback):
"""
Here is where the processing itself takes place.
This algorithm imports data from
"""

# Retrieve the API key and feature sink.
APIKey = self.parameterAsString(
parameters,
self.INPUT,
context
)
# And the description of the output layer (most likely 'memory:').
outName = self.parameterAsOutputLayer(
parameters,
self.OUTPUT,
context
)

feedback.setProgressText('Loading routes...')
# Begin processing
start = (-114.31506,48.20218)
end = (-114.63478,48.19400)
client = openrouteservice.Client(key=APIKey)
routes = client.directions((start,end))
encoded = routes['routes'][0]['geometry']
decoded = openrouteservice.convert.decode_polyline(encoded)
routeLayer = QgsVectorLayer("LineString", "Kalispell to Ashley Lake",
"memory")
provider = routeLayer.dataProvider()
feat = QgsFeature()
feat.setGeometry(QgsGeometry.fromPolyline(
[QgsPoint(pt[0],pt[1]) for pt in decoded['coordinates']]))
provider.addFeature(feat)
QgsProject.instance().addMapLayer(routeLayer)
result = processing.run('qgis:densifygeometriesgivenaninterval', {
'INPUT':routeLayer,
'INTERVAL':0.001,
'OUTPUT':'memory:'
})
result2 = processing.run('native:extractvertices', {
'INPUT':result['OUTPUT'],
'OUTPUT':outName
})
# This is the output layer:
outLayer = result2['OUTPUT']
# Set up the desired heatmap renderer:
rndrr = QgsHeatmapRenderer()
rndrr.setColorRamp(QgsGradientColorRamp(
QColor('transparent'),QColor(227,26,28)))
rndrr.setRadiusUnit(1)
rndrr.setRadius(500)
# Set the output layer's renderer to the heatmap renderer just defined
outLayer.setRenderer(rndrr)
# Done with processing
feedback.pushInfo("Done with processing.")

# Return the output layer.
return {self.OUTPUT: outLayer.id()}



And the output from running the algorithm:
Algorithm Output
(The algorithm requires me to input my OpenRouteService API key, which I've blacked out in this screenshot.)



As you can see, the algorithm appears to have been successful, except for the final loading of results.



As instructed, I checked the Log Messages Panel's Processing tab, but it contains no indication of the error, only this:
Processing Tab, Log Messages Panel
Each entry here corresponds to a layer generated by the native QGIS Densify by Interval and Extract Vertices algorithms, which mine calls.



However, the Python Warning log tab does contain something interesting, albeit unhelpful:
Python Warning Tab, Log Messages Panel



I am relatively new to QGIS, so I'm unsure of what might be happening here. Can anyone offer some insight into this problem?










share|improve this question









New contributor




Luke R is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    1















    I'm building a Python algorithm for QGIS 3, to be run from the Processing Toolbox. I've finished debugging the algorithm body, which seems to work, but QGIS is unable to load its output.



    To summarize, the algorithm generates a vector layer in memory, sets up a QgsHeatmapRenderer object with some desired parameters, and sets this as the layer's renderer. It works correctly, but QGIS is somehow unable to deal with the result.



    Here's the algorithm code (also available on GitHub):



    # -*- coding: utf-8 -*-

    # Create a heatmap of a single route, based on data from the OpenRouteService
    # API. This is a proof-of-concept script only.

    from PyQt5.QtCore import QCoreApplication
    from PyQt5.QtGui import QColor
    from qgis.core import *
    import processing
    import openrouteservice

    # Define variables as necessary
    # Here
    failures = 0

    # Create necessary functions
    # Here

    class MyProcessingAlgorithm(QgsProcessingAlgorithm):
    """
    This algorithm creates a heatmap of a single route, based on data from the
    OpenRouteService API. This is a proof-of-concept script only.
    """

    # Constants used to refer to parameters and outputs. They will be
    # used when calling the algorithm from another algorithm, or when
    # calling from the QGIS console.

    INPUT = 'INPUT'
    OUTPUT = 'OUTPUT'

    def tr(self, string):
    """
    Returns a translatable string with the self.tr() function.
    """
    return QCoreApplication.translate('Processing', string)

    def createInstance(self):
    return MyProcessingAlgorithm()

    def name(self):
    """
    Returns the algorithm name, used for identifying the algorithm. This
    string should be fixed for the algorithm, and must not be localised.
    The name should be unique within each provider. Names should contain
    lowercase alphanumeric characters only and no spaces or other
    formatting characters.
    """
    return 'singlepathheatmap'

    def displayName(self):
    """
    Returns the translated algorithm name, which should be used for any
    user-visible display of the algorithm name.
    """
    return self.tr('Single Path Heatmap')

    def group(self):
    """
    Returns the name of the group this algorithm belongs to. This string
    should be localised.
    """
    return self.tr('Science Fair 2019')

    def groupId(self):
    """
    Returns the unique ID of the group this algorithm belongs to. This
    string should be fixed for the algorithm, and must not be localised.
    The group id should be unique within each provider. Group id should
    contain lowercase alphanumeric characters only and no spaces or other
    formatting characters.
    """
    return 'sciencefairtwentynineteen'

    def shortHelpString(self):
    """
    Returns a localised short helper string for the algorithm. This string
    should provide a basic description about what the algorithm does and the
    parameters and outputs associated with it.
    """
    return self.tr("This script creates a heatmap of a single route,
    based on data from the OpenRouteService API. This is
    a proof-of-concept script only.")

    def initAlgorithm(self, config=None):
    """
    Define the inputs and output of the algorithm, along with some other
    properties.
    """

    # Add a text input for the user's OpenRouteService API key.
    self.addParameter(
    QgsProcessingParameterString(
    self.INPUT,
    self.tr('Your OpenRouteService API Key')
    )
    )

    # Add a feature sink in which to store our processed features (this
    # usually takes the form of a newly created vector layer when the
    # algorithm is run in QGIS).
    self.addParameter(
    QgsProcessingParameterFeatureSink(
    self.OUTPUT,
    self.tr('Heatmap Layer')
    )
    )

    def processAlgorithm(self, parameters, context, feedback):
    """
    Here is where the processing itself takes place.
    This algorithm imports data from
    """

    # Retrieve the API key and feature sink.
    APIKey = self.parameterAsString(
    parameters,
    self.INPUT,
    context
    )
    # And the description of the output layer (most likely 'memory:').
    outName = self.parameterAsOutputLayer(
    parameters,
    self.OUTPUT,
    context
    )

    feedback.setProgressText('Loading routes...')
    # Begin processing
    start = (-114.31506,48.20218)
    end = (-114.63478,48.19400)
    client = openrouteservice.Client(key=APIKey)
    routes = client.directions((start,end))
    encoded = routes['routes'][0]['geometry']
    decoded = openrouteservice.convert.decode_polyline(encoded)
    routeLayer = QgsVectorLayer("LineString", "Kalispell to Ashley Lake",
    "memory")
    provider = routeLayer.dataProvider()
    feat = QgsFeature()
    feat.setGeometry(QgsGeometry.fromPolyline(
    [QgsPoint(pt[0],pt[1]) for pt in decoded['coordinates']]))
    provider.addFeature(feat)
    QgsProject.instance().addMapLayer(routeLayer)
    result = processing.run('qgis:densifygeometriesgivenaninterval', {
    'INPUT':routeLayer,
    'INTERVAL':0.001,
    'OUTPUT':'memory:'
    })
    result2 = processing.run('native:extractvertices', {
    'INPUT':result['OUTPUT'],
    'OUTPUT':outName
    })
    # This is the output layer:
    outLayer = result2['OUTPUT']
    # Set up the desired heatmap renderer:
    rndrr = QgsHeatmapRenderer()
    rndrr.setColorRamp(QgsGradientColorRamp(
    QColor('transparent'),QColor(227,26,28)))
    rndrr.setRadiusUnit(1)
    rndrr.setRadius(500)
    # Set the output layer's renderer to the heatmap renderer just defined
    outLayer.setRenderer(rndrr)
    # Done with processing
    feedback.pushInfo("Done with processing.")

    # Return the output layer.
    return {self.OUTPUT: outLayer.id()}



    And the output from running the algorithm:
    Algorithm Output
    (The algorithm requires me to input my OpenRouteService API key, which I've blacked out in this screenshot.)



    As you can see, the algorithm appears to have been successful, except for the final loading of results.



    As instructed, I checked the Log Messages Panel's Processing tab, but it contains no indication of the error, only this:
    Processing Tab, Log Messages Panel
    Each entry here corresponds to a layer generated by the native QGIS Densify by Interval and Extract Vertices algorithms, which mine calls.



    However, the Python Warning log tab does contain something interesting, albeit unhelpful:
    Python Warning Tab, Log Messages Panel



    I am relatively new to QGIS, so I'm unsure of what might be happening here. Can anyone offer some insight into this problem?










    share|improve this question









    New contributor




    Luke R is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      1












      1








      1








      I'm building a Python algorithm for QGIS 3, to be run from the Processing Toolbox. I've finished debugging the algorithm body, which seems to work, but QGIS is unable to load its output.



      To summarize, the algorithm generates a vector layer in memory, sets up a QgsHeatmapRenderer object with some desired parameters, and sets this as the layer's renderer. It works correctly, but QGIS is somehow unable to deal with the result.



      Here's the algorithm code (also available on GitHub):



      # -*- coding: utf-8 -*-

      # Create a heatmap of a single route, based on data from the OpenRouteService
      # API. This is a proof-of-concept script only.

      from PyQt5.QtCore import QCoreApplication
      from PyQt5.QtGui import QColor
      from qgis.core import *
      import processing
      import openrouteservice

      # Define variables as necessary
      # Here
      failures = 0

      # Create necessary functions
      # Here

      class MyProcessingAlgorithm(QgsProcessingAlgorithm):
      """
      This algorithm creates a heatmap of a single route, based on data from the
      OpenRouteService API. This is a proof-of-concept script only.
      """

      # Constants used to refer to parameters and outputs. They will be
      # used when calling the algorithm from another algorithm, or when
      # calling from the QGIS console.

      INPUT = 'INPUT'
      OUTPUT = 'OUTPUT'

      def tr(self, string):
      """
      Returns a translatable string with the self.tr() function.
      """
      return QCoreApplication.translate('Processing', string)

      def createInstance(self):
      return MyProcessingAlgorithm()

      def name(self):
      """
      Returns the algorithm name, used for identifying the algorithm. This
      string should be fixed for the algorithm, and must not be localised.
      The name should be unique within each provider. Names should contain
      lowercase alphanumeric characters only and no spaces or other
      formatting characters.
      """
      return 'singlepathheatmap'

      def displayName(self):
      """
      Returns the translated algorithm name, which should be used for any
      user-visible display of the algorithm name.
      """
      return self.tr('Single Path Heatmap')

      def group(self):
      """
      Returns the name of the group this algorithm belongs to. This string
      should be localised.
      """
      return self.tr('Science Fair 2019')

      def groupId(self):
      """
      Returns the unique ID of the group this algorithm belongs to. This
      string should be fixed for the algorithm, and must not be localised.
      The group id should be unique within each provider. Group id should
      contain lowercase alphanumeric characters only and no spaces or other
      formatting characters.
      """
      return 'sciencefairtwentynineteen'

      def shortHelpString(self):
      """
      Returns a localised short helper string for the algorithm. This string
      should provide a basic description about what the algorithm does and the
      parameters and outputs associated with it.
      """
      return self.tr("This script creates a heatmap of a single route,
      based on data from the OpenRouteService API. This is
      a proof-of-concept script only.")

      def initAlgorithm(self, config=None):
      """
      Define the inputs and output of the algorithm, along with some other
      properties.
      """

      # Add a text input for the user's OpenRouteService API key.
      self.addParameter(
      QgsProcessingParameterString(
      self.INPUT,
      self.tr('Your OpenRouteService API Key')
      )
      )

      # Add a feature sink in which to store our processed features (this
      # usually takes the form of a newly created vector layer when the
      # algorithm is run in QGIS).
      self.addParameter(
      QgsProcessingParameterFeatureSink(
      self.OUTPUT,
      self.tr('Heatmap Layer')
      )
      )

      def processAlgorithm(self, parameters, context, feedback):
      """
      Here is where the processing itself takes place.
      This algorithm imports data from
      """

      # Retrieve the API key and feature sink.
      APIKey = self.parameterAsString(
      parameters,
      self.INPUT,
      context
      )
      # And the description of the output layer (most likely 'memory:').
      outName = self.parameterAsOutputLayer(
      parameters,
      self.OUTPUT,
      context
      )

      feedback.setProgressText('Loading routes...')
      # Begin processing
      start = (-114.31506,48.20218)
      end = (-114.63478,48.19400)
      client = openrouteservice.Client(key=APIKey)
      routes = client.directions((start,end))
      encoded = routes['routes'][0]['geometry']
      decoded = openrouteservice.convert.decode_polyline(encoded)
      routeLayer = QgsVectorLayer("LineString", "Kalispell to Ashley Lake",
      "memory")
      provider = routeLayer.dataProvider()
      feat = QgsFeature()
      feat.setGeometry(QgsGeometry.fromPolyline(
      [QgsPoint(pt[0],pt[1]) for pt in decoded['coordinates']]))
      provider.addFeature(feat)
      QgsProject.instance().addMapLayer(routeLayer)
      result = processing.run('qgis:densifygeometriesgivenaninterval', {
      'INPUT':routeLayer,
      'INTERVAL':0.001,
      'OUTPUT':'memory:'
      })
      result2 = processing.run('native:extractvertices', {
      'INPUT':result['OUTPUT'],
      'OUTPUT':outName
      })
      # This is the output layer:
      outLayer = result2['OUTPUT']
      # Set up the desired heatmap renderer:
      rndrr = QgsHeatmapRenderer()
      rndrr.setColorRamp(QgsGradientColorRamp(
      QColor('transparent'),QColor(227,26,28)))
      rndrr.setRadiusUnit(1)
      rndrr.setRadius(500)
      # Set the output layer's renderer to the heatmap renderer just defined
      outLayer.setRenderer(rndrr)
      # Done with processing
      feedback.pushInfo("Done with processing.")

      # Return the output layer.
      return {self.OUTPUT: outLayer.id()}



      And the output from running the algorithm:
      Algorithm Output
      (The algorithm requires me to input my OpenRouteService API key, which I've blacked out in this screenshot.)



      As you can see, the algorithm appears to have been successful, except for the final loading of results.



      As instructed, I checked the Log Messages Panel's Processing tab, but it contains no indication of the error, only this:
      Processing Tab, Log Messages Panel
      Each entry here corresponds to a layer generated by the native QGIS Densify by Interval and Extract Vertices algorithms, which mine calls.



      However, the Python Warning log tab does contain something interesting, albeit unhelpful:
      Python Warning Tab, Log Messages Panel



      I am relatively new to QGIS, so I'm unsure of what might be happening here. Can anyone offer some insight into this problem?










      share|improve this question









      New contributor




      Luke R is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I'm building a Python algorithm for QGIS 3, to be run from the Processing Toolbox. I've finished debugging the algorithm body, which seems to work, but QGIS is unable to load its output.



      To summarize, the algorithm generates a vector layer in memory, sets up a QgsHeatmapRenderer object with some desired parameters, and sets this as the layer's renderer. It works correctly, but QGIS is somehow unable to deal with the result.



      Here's the algorithm code (also available on GitHub):



      # -*- coding: utf-8 -*-

      # Create a heatmap of a single route, based on data from the OpenRouteService
      # API. This is a proof-of-concept script only.

      from PyQt5.QtCore import QCoreApplication
      from PyQt5.QtGui import QColor
      from qgis.core import *
      import processing
      import openrouteservice

      # Define variables as necessary
      # Here
      failures = 0

      # Create necessary functions
      # Here

      class MyProcessingAlgorithm(QgsProcessingAlgorithm):
      """
      This algorithm creates a heatmap of a single route, based on data from the
      OpenRouteService API. This is a proof-of-concept script only.
      """

      # Constants used to refer to parameters and outputs. They will be
      # used when calling the algorithm from another algorithm, or when
      # calling from the QGIS console.

      INPUT = 'INPUT'
      OUTPUT = 'OUTPUT'

      def tr(self, string):
      """
      Returns a translatable string with the self.tr() function.
      """
      return QCoreApplication.translate('Processing', string)

      def createInstance(self):
      return MyProcessingAlgorithm()

      def name(self):
      """
      Returns the algorithm name, used for identifying the algorithm. This
      string should be fixed for the algorithm, and must not be localised.
      The name should be unique within each provider. Names should contain
      lowercase alphanumeric characters only and no spaces or other
      formatting characters.
      """
      return 'singlepathheatmap'

      def displayName(self):
      """
      Returns the translated algorithm name, which should be used for any
      user-visible display of the algorithm name.
      """
      return self.tr('Single Path Heatmap')

      def group(self):
      """
      Returns the name of the group this algorithm belongs to. This string
      should be localised.
      """
      return self.tr('Science Fair 2019')

      def groupId(self):
      """
      Returns the unique ID of the group this algorithm belongs to. This
      string should be fixed for the algorithm, and must not be localised.
      The group id should be unique within each provider. Group id should
      contain lowercase alphanumeric characters only and no spaces or other
      formatting characters.
      """
      return 'sciencefairtwentynineteen'

      def shortHelpString(self):
      """
      Returns a localised short helper string for the algorithm. This string
      should provide a basic description about what the algorithm does and the
      parameters and outputs associated with it.
      """
      return self.tr("This script creates a heatmap of a single route,
      based on data from the OpenRouteService API. This is
      a proof-of-concept script only.")

      def initAlgorithm(self, config=None):
      """
      Define the inputs and output of the algorithm, along with some other
      properties.
      """

      # Add a text input for the user's OpenRouteService API key.
      self.addParameter(
      QgsProcessingParameterString(
      self.INPUT,
      self.tr('Your OpenRouteService API Key')
      )
      )

      # Add a feature sink in which to store our processed features (this
      # usually takes the form of a newly created vector layer when the
      # algorithm is run in QGIS).
      self.addParameter(
      QgsProcessingParameterFeatureSink(
      self.OUTPUT,
      self.tr('Heatmap Layer')
      )
      )

      def processAlgorithm(self, parameters, context, feedback):
      """
      Here is where the processing itself takes place.
      This algorithm imports data from
      """

      # Retrieve the API key and feature sink.
      APIKey = self.parameterAsString(
      parameters,
      self.INPUT,
      context
      )
      # And the description of the output layer (most likely 'memory:').
      outName = self.parameterAsOutputLayer(
      parameters,
      self.OUTPUT,
      context
      )

      feedback.setProgressText('Loading routes...')
      # Begin processing
      start = (-114.31506,48.20218)
      end = (-114.63478,48.19400)
      client = openrouteservice.Client(key=APIKey)
      routes = client.directions((start,end))
      encoded = routes['routes'][0]['geometry']
      decoded = openrouteservice.convert.decode_polyline(encoded)
      routeLayer = QgsVectorLayer("LineString", "Kalispell to Ashley Lake",
      "memory")
      provider = routeLayer.dataProvider()
      feat = QgsFeature()
      feat.setGeometry(QgsGeometry.fromPolyline(
      [QgsPoint(pt[0],pt[1]) for pt in decoded['coordinates']]))
      provider.addFeature(feat)
      QgsProject.instance().addMapLayer(routeLayer)
      result = processing.run('qgis:densifygeometriesgivenaninterval', {
      'INPUT':routeLayer,
      'INTERVAL':0.001,
      'OUTPUT':'memory:'
      })
      result2 = processing.run('native:extractvertices', {
      'INPUT':result['OUTPUT'],
      'OUTPUT':outName
      })
      # This is the output layer:
      outLayer = result2['OUTPUT']
      # Set up the desired heatmap renderer:
      rndrr = QgsHeatmapRenderer()
      rndrr.setColorRamp(QgsGradientColorRamp(
      QColor('transparent'),QColor(227,26,28)))
      rndrr.setRadiusUnit(1)
      rndrr.setRadius(500)
      # Set the output layer's renderer to the heatmap renderer just defined
      outLayer.setRenderer(rndrr)
      # Done with processing
      feedback.pushInfo("Done with processing.")

      # Return the output layer.
      return {self.OUTPUT: outLayer.id()}



      And the output from running the algorithm:
      Algorithm Output
      (The algorithm requires me to input my OpenRouteService API key, which I've blacked out in this screenshot.)



      As you can see, the algorithm appears to have been successful, except for the final loading of results.



      As instructed, I checked the Log Messages Panel's Processing tab, but it contains no indication of the error, only this:
      Processing Tab, Log Messages Panel
      Each entry here corresponds to a layer generated by the native QGIS Densify by Interval and Extract Vertices algorithms, which mine calls.



      However, the Python Warning log tab does contain something interesting, albeit unhelpful:
      Python Warning Tab, Log Messages Panel



      I am relatively new to QGIS, so I'm unsure of what might be happening here. Can anyone offer some insight into this problem?







      python pyqgis qgis-3 qgis-processing






      share|improve this question









      New contributor




      Luke R is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Luke R is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 1 min ago







      Luke R













      New contributor




      Luke R is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Feb 18 at 22:13









      Luke RLuke R

      63




      63




      New contributor




      Luke R is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Luke R is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Luke R is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes











          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
          });


          }
          });






          Luke R is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f312693%2funable-to-load-output-layer-from-python-algorithm-in-qgis-3%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          Luke R is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Luke R is a new contributor. Be nice, and check out our Code of Conduct.













          Luke R is a new contributor. Be nice, and check out our Code of Conduct.












          Luke R is a new contributor. Be nice, and check out our Code of Conduct.
















          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.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f312693%2funable-to-load-output-layer-from-python-algorithm-in-qgis-3%23new-answer', 'question_page');
          }
          );

          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







          Popular posts from this blog

          Щит и меч (фильм) Содержание Названия серий | Сюжет |...

          Венесуэла на летних Олимпийских играх 2000 Содержание Состав...

          Meter-Bus Содержание Параметры шины | Стандартизация |...