[QGIS-Developer] cannot import processing algorithm in 3.6

Raymond Nijssen r.nijssen at terglobo.nl
Wed Mar 20 19:17:20 PDT 2019


Hi Nyall, thanks for your answer.

Somewhere in the middle of a calculation process (not an algorithm) I'd 
like to add a polygon feature to a line layer. I'm using the function to 
turn the polygon into a line geometry.



I'm using it like this and don't know I figured this out or decided on it:

from processing.algs.qgis import PolygonsToLines

toLines = PolygonsToLines.PolygonsToLines().convertToLines


then later on many places in my code:

geom = toLines(geom)



I remember it took me a while to figure out that second line, but having 
my own short "alias" function toLines() is very convenient. But maybe I 
can create it in another way, holding the processing.run code.

I will try tomorrow.

One last question, it seems to me like the old code is working again in 
3.7. Can you confirm that?

Kind regards,
Raymond



On 21-03-19 01:34, Nyall Dawson wrote:
> On Thu, 21 Mar 2019 at 02:40, Raymond Nijssen <r.nijssen at terglobo.nl> wrote:
>>
>> The folowing line works for me in 3.4.3 and 3.7 (built today) but not in
>> 3.6.0
>>
>> from processing.algs.qgis import PolygonsToLines
> 
> It was ported from Python -> c++, so is no longer importable like
> this. What's your use case for importing direct rather than running
> via processing.run?
> 
> Nyall
> 

-- 
Terglobo
Fahrenheitstraat 1
5223 BJ 's-Hertogenbosch
The Netherlands
+31 (0) 6 25 31 49 83


More information about the QGIS-Developer mailing list