3

Context: In the Graphical Modeler, I want to use an attribute of my source layer to set the buffer distance parameter. Using the "Pre-calculated Value" option, and entering the attribute name in the expression editor (in quotes) does not work. It says the field does not exist.

I am looking around for the source code, to see what might be the problem. Or really just to learn more about how the code works. (In the meantime, I have already written a processing plugin which uses the geometry().buffer() method.)

Inside the QGIS.app package,

Contents/Resources/python/plugins/processing/algs/qgis/Buffer.py

does exist. However, it is not processing plugin code.
That is, it does not go through initAlgorighm, addParameter, etc.

I looked at several of its neighboring files (e.g., BoxPlot.py) and they ARE clearly processing plugin code.

Why is Buffer.py different than its neighboring files and how does it manage to show up in the Processing Toolbox and Graphical Modeler if it does not have the processing plugin code?

This "non processing plugin" Buffer.py code file is also at: https://github.com/qgis/QGIS/blob/b6a7a1070329a1f167341e3187781954d28f2f39/python/plugins/processing/algs/qgis/Buffer.py

1 Answer 1

7

The buffer algorithm is implemented in C++: https://github.com/qgis/QGIS/blob/fbc2082b7e25042c5f82cb000c52d84625b31624/src/analysis/processing/qgsalgorithmbuffer.cpp

The Buffer.py file you found is only used for the VariableDistanceBuffer which currently is still written in Python: https://github.com/qgis/QGIS/blob/fbc2082b7e25042c5f82cb000c52d84625b31624/python/plugins/processing/algs/qgis/VariableDistanceBuffer.py#L128

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.