Re: [QGIS-Developer] QGIS3 - processing python script. Read features from output layer

2018-02-15 Thread Nyall Dawson
On 16 February 2018 at 17:29, kimaidou wrote: > Thanks Nyall, > > Our posts crossed ! > > Ok for the shortcut and the getMapLayer method. > Here you go: https://github.com/qgis/QGIS/pull/6359 ___ QGIS-Developer mailing list

Re: [QGIS-Developer] QGIS3 - processing python script. Read features from output layer

2018-02-15 Thread kimaidou
Thanks for your explanation ! I also think it makes sense to share source layers in some cache in the future. 2018-02-16 7:36 GMT+01:00 Nyall Dawson : > On 16 February 2018 at 17:29, kimaidou wrote: > > Thanks Nyall, > > > > Our posts crossed ! > > >

Re: [QGIS-Developer] QGIS3 - processing python script. Read features from output layer

2018-02-15 Thread Nyall Dawson
On 16 February 2018 at 17:29, kimaidou wrote: > Thanks Nyall, > > Our posts crossed ! > > Ok for the shortcut and the getMapLayer method. > > One question : in my alg, if I use QgsProcessingParameterFeatureSource > instead of QgsProcessingParameterVectorLayer for my input, can

Re: [QGIS-Developer] QGIS3 - processing python script. Read features from output layer

2018-02-15 Thread kimaidou
Thanks Nyall, Our posts crossed ! Ok for the shortcut and the getMapLayer method. One question : in my alg, if I use QgsProcessingParameterFeatureSource instead of QgsProcessingParameterVectorLayer for my input, can I still use mapLayerFromString and the getFeatures, or is there a

Re: [QGIS-Developer] QGIS3 - processing python script. Read features from output layer

2018-02-15 Thread kimaidou
Found id ! I have to use mapLayerFromString : blayer = QgsProcessingUtils.mapLayerFromString(area_result['OUTPUT'], context) \o/ 2018-02-16 7:11 GMT+01:00 kimaidou : > Hi Salvatore, > > I already tried to use > > blayer = area_result['OUTPUT'] > for feat in

Re: [QGIS-Developer] QGIS3 - processing python script. Read features from output layer

2018-02-15 Thread Nyall Dawson
On 16 February 2018 at 04:36, kimaidou wrote: > Hi all, > > I have a simple processing python alg which > * generates a buffer with qgis:buffer > * use qgis:fieldcalculator to add an buf_area field -> the output vector of > my alg is this buffer+new field. > > I would like to

Re: [QGIS-Developer] QGIS3 - processing python script. Read features from output layer

2018-02-15 Thread kimaidou
Hi Salvatore, I already tried to use blayer = area_result['OUTPUT'] for feat in blayer.getFeatures(): with no success . If I do so I get AttributeError: 'str' object has no attribute 'getFeatures' There must be a way to transforme this string representing the layer as a processing

Re: [QGIS-Developer] QGIS3 - processing python script. Read features from output layer

2018-02-15 Thread kimaidou
Hi Salvatore, I already tried to use blayer = area_result['OUTPUT'] for feat in blayer.getFeatures(): with no success . If I do so I get AttributeError: 'str' object has no attribute 'getFeatures' There must be a way to transforme this string representing the layer as a processing

Re: [QGIS-Developer] QGIS3 - processing python script. Read features from output layer

2018-02-15 Thread Salvatore Larosa
Hi Michaƫl, On Thu, Feb 15, 2018 at 6:36 PM, kimaidou wrote: > Hi all, > > I have a simple processing python alg which > * generates a buffer with qgis:buffer > * use qgis:fieldcalculator to add an buf_area field -> the output vector > of my alg is this buffer+new field. > >

[QGIS-Developer] QGIS3 - processing python script. Read features from output layer

2018-02-15 Thread kimaidou
Hi all, I have a simple processing python alg which * generates a buffer with qgis:buffer * use qgis:fieldcalculator to add an buf_area field -> the output vector of my alg is this buffer+new field. I would like to parse the features of the output vector in order to gather some information and