0

I would like to know if I can use the code of the default functions that come in QGIS, for example the Intersection function.

When you click on the help button it redirects you to the user guide where comes de description of the function and there is a section "Python code" where comes a small code for that specific function. In almost all the vectors geoprocessing the library "processing" appears. But I could not install it from anywhere.

Does anyone know if it is possible use this code and library in my own Python script?

  • 1
    Possibly it's in the QGIS source in C, the libraries are compiled to a dll with a wrapper defining the python interfaces... the question is how far do you want to go down this rabbit hole? Are you asking because intersection isn't working? A reinstall might fix that. Or is it that you want to grab the method from QGIS and use it in your own custom tool? If that's the case you've got a steep learning curve ahead if you don't know C and even if you do tracking back through the includes is no trivial task. – Michael Stimson Oct 29 at 7:23
  • Hello @MichaelStimson I am trying to use direct code of some of the functions of Qgis because I have been having problems with the functions of the intersection of shapely (the function within). My goal is make an identification of points within a polygon but for some reason this function simple does not work, it gaves me just one point as true and the rest false (wich is not correct) – Orlando Andrade Oct 29 at 7:33
  • For this reason Im trying with other options. Use the code of some of the functions of Qgis will be great but as I mention the library that uses "processing" I just can not install it. – Orlando Andrade Oct 29 at 7:34
  • It's installed by default with QGIS install. If you have QGIS in your environment, you can create a QGIS app (like a PyQt app) and import processing and use it. – J. Monticolo Oct 29 at 12:16
  • Check your polygon geometries, there may be self intersections which will cause the geometry engine to fail. qgistutorials.com/en/docs/3/handling_invalid_geometries.html might be of some help. – Michael Stimson Oct 29 at 23:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.