Processing algorithm doesen't work - PyQGIS 3.4

hrule into tikz circle node

Why is 'diphthong' not pronounced otherwise?

Word for something that's always reliable, but never the best?

Case protection with emphasis in biblatex

Reading Mishnayos without understanding

Are all power cords made equal?

How is this property called for mod?

Buying a "Used" Router

What to do with threats of blacklisting?

Sharepoint metadata URL

Is there any way to make an Apex method parameter lazy?

How to create a label containing values from different layers in QGIS

Coworker asking me to not bring cakes due to self control issue. What should I do?

Why is Shelob considered evil?

Does the US government have any planning in place to ensure there's no shortages of food, fuel, steel and other commodities?

Allow console draw poker game to output more hands

Count repetitions of an array

Does it take energy to move something in a circle?

Sitecore 9.1 Installation - Skip to particular step

What's the oldest plausible frozen specimen for a Jurassic Park style story-line?

Writing dialogues for characters whose first language is not English

How to write cases in LaTeX?

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

Boss asked me to sign a resignation paper without a date on it along with my new contract



Processing algorithm doesen't work - PyQGIS 3.4














0















I am trying to execute the processing algorithm extractbylocation. Anyway, firstly I run that algorithm in QGIS3 and then just copy the code from the processing history and changes paths to variables. I have some features with invalid geometries (in QGIS in the settings it is set for processing to ignore that features),so that is maybe my problem. In order to avoid that I deleted all the features with invalid geometries and the problem is still there.
So my code looks like this:



input_path = 'C:/Users/file.shp'
output_path = 'C:/Users/file_out.shp
crs = QgsCoordinateReferenceSystem("epsg:4326")
input = QgsVectorLayer(input_path, "links", "ogr")
input.setCrs(crs)

#deleting features with invalid geometries
for f in input.getFeatures():
geom = f.geometry()
if geom.isGeosValid():
print('valid')
else:
input.deleteFeature(f.id())
print('not valid')

sys.path.append('C:/Program Files/QGIS 3.4/apps/qgis/python/plugins')
import processing
from processing.core.Processing import Processing
Processing.initialize()
QgsApplication.processingRegistry().addProvider(QgsNativeAlgorithms())

processing.run("native:extractbylocation",
{'INPUT': input, 'PREDICATE': [1],
'INTERSECT': 'C:\Users\points.shp|layername=pointss',
'OUTPUT': outputh_path})


I got the error next to the output line in the processing algorithm.



 File "path_to_my_file_py", line 49,    'OUTPUT': outputh_path})
File "path_to_my_file_py", line 84, in run
return Processing.runAlgorithm(algOrName, parameters, onFinish, feedback, context)
File "path_to_processing_file_py", line 194, in runAlgorithm
raise QgsProcessingException(msg)
_core.QgsProcessingException: There were errors executing the algorithm.








share



























    0















    I am trying to execute the processing algorithm extractbylocation. Anyway, firstly I run that algorithm in QGIS3 and then just copy the code from the processing history and changes paths to variables. I have some features with invalid geometries (in QGIS in the settings it is set for processing to ignore that features),so that is maybe my problem. In order to avoid that I deleted all the features with invalid geometries and the problem is still there.
    So my code looks like this:



    input_path = 'C:/Users/file.shp'
    output_path = 'C:/Users/file_out.shp
    crs = QgsCoordinateReferenceSystem("epsg:4326")
    input = QgsVectorLayer(input_path, "links", "ogr")
    input.setCrs(crs)

    #deleting features with invalid geometries
    for f in input.getFeatures():
    geom = f.geometry()
    if geom.isGeosValid():
    print('valid')
    else:
    input.deleteFeature(f.id())
    print('not valid')

    sys.path.append('C:/Program Files/QGIS 3.4/apps/qgis/python/plugins')
    import processing
    from processing.core.Processing import Processing
    Processing.initialize()
    QgsApplication.processingRegistry().addProvider(QgsNativeAlgorithms())

    processing.run("native:extractbylocation",
    {'INPUT': input, 'PREDICATE': [1],
    'INTERSECT': 'C:\Users\points.shp|layername=pointss',
    'OUTPUT': outputh_path})


    I got the error next to the output line in the processing algorithm.



     File "path_to_my_file_py", line 49,    'OUTPUT': outputh_path})
    File "path_to_my_file_py", line 84, in run
    return Processing.runAlgorithm(algOrName, parameters, onFinish, feedback, context)
    File "path_to_processing_file_py", line 194, in runAlgorithm
    raise QgsProcessingException(msg)
    _core.QgsProcessingException: There were errors executing the algorithm.








    share

























      0












      0








      0








      I am trying to execute the processing algorithm extractbylocation. Anyway, firstly I run that algorithm in QGIS3 and then just copy the code from the processing history and changes paths to variables. I have some features with invalid geometries (in QGIS in the settings it is set for processing to ignore that features),so that is maybe my problem. In order to avoid that I deleted all the features with invalid geometries and the problem is still there.
      So my code looks like this:



      input_path = 'C:/Users/file.shp'
      output_path = 'C:/Users/file_out.shp
      crs = QgsCoordinateReferenceSystem("epsg:4326")
      input = QgsVectorLayer(input_path, "links", "ogr")
      input.setCrs(crs)

      #deleting features with invalid geometries
      for f in input.getFeatures():
      geom = f.geometry()
      if geom.isGeosValid():
      print('valid')
      else:
      input.deleteFeature(f.id())
      print('not valid')

      sys.path.append('C:/Program Files/QGIS 3.4/apps/qgis/python/plugins')
      import processing
      from processing.core.Processing import Processing
      Processing.initialize()
      QgsApplication.processingRegistry().addProvider(QgsNativeAlgorithms())

      processing.run("native:extractbylocation",
      {'INPUT': input, 'PREDICATE': [1],
      'INTERSECT': 'C:\Users\points.shp|layername=pointss',
      'OUTPUT': outputh_path})


      I got the error next to the output line in the processing algorithm.



       File "path_to_my_file_py", line 49,    'OUTPUT': outputh_path})
      File "path_to_my_file_py", line 84, in run
      return Processing.runAlgorithm(algOrName, parameters, onFinish, feedback, context)
      File "path_to_processing_file_py", line 194, in runAlgorithm
      raise QgsProcessingException(msg)
      _core.QgsProcessingException: There were errors executing the algorithm.








      share














      I am trying to execute the processing algorithm extractbylocation. Anyway, firstly I run that algorithm in QGIS3 and then just copy the code from the processing history and changes paths to variables. I have some features with invalid geometries (in QGIS in the settings it is set for processing to ignore that features),so that is maybe my problem. In order to avoid that I deleted all the features with invalid geometries and the problem is still there.
      So my code looks like this:



      input_path = 'C:/Users/file.shp'
      output_path = 'C:/Users/file_out.shp
      crs = QgsCoordinateReferenceSystem("epsg:4326")
      input = QgsVectorLayer(input_path, "links", "ogr")
      input.setCrs(crs)

      #deleting features with invalid geometries
      for f in input.getFeatures():
      geom = f.geometry()
      if geom.isGeosValid():
      print('valid')
      else:
      input.deleteFeature(f.id())
      print('not valid')

      sys.path.append('C:/Program Files/QGIS 3.4/apps/qgis/python/plugins')
      import processing
      from processing.core.Processing import Processing
      Processing.initialize()
      QgsApplication.processingRegistry().addProvider(QgsNativeAlgorithms())

      processing.run("native:extractbylocation",
      {'INPUT': input, 'PREDICATE': [1],
      'INTERSECT': 'C:\Users\points.shp|layername=pointss',
      'OUTPUT': outputh_path})


      I got the error next to the output line in the processing algorithm.



       File "path_to_my_file_py", line 49,    'OUTPUT': outputh_path})
      File "path_to_my_file_py", line 84, in run
      return Processing.runAlgorithm(algOrName, parameters, onFinish, feedback, context)
      File "path_to_processing_file_py", line 194, in runAlgorithm
      raise QgsProcessingException(msg)
      _core.QgsProcessingException: There were errors executing the algorithm.






      qgis pyqgis qgis-3 qgis-processing





      share












      share










      share



      share










      asked 1 min ago









      NevenNeven

      1369




      1369






















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


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f313487%2fprocessing-algorithm-doesent-work-pyqgis-3-4%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
















          draft saved

          draft discarded




















































          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%2f313487%2fprocessing-algorithm-doesent-work-pyqgis-3-4%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 Содержание Параметры шины | Стандартизация |...