[QGIS-Developer] processing output in pyqgis code

Pierluigi De Rosa pierluigi.derosa at gfosservices.it
Mon Oct 15 07:20:23 PDT 2018


Dear All, 


I have a strange phenomena running some code. 
I'm using the processing algorithm qgis:pointsalonglines output = processing.run( "qgis:pointsalonglines" , { 'INPUT' : poly_to_lines , 
'DISTANCE' : spaced_pts_distance , 
'START_OFFSET' : 0 , 
'END_OFFSET' : 0 , 'OUTPUT' : 'memory:' }) 


The output vector should have 3 columns (FID, angle,Distance) 


If I run the code inside the python console plugin (even from a sample code) It works correctly but if I run ti inside my plugin, calling such lines inside a method the output only have 2 columns (distance and angle) so the 
receiver_points_memory_layer = output[ 'OUTPUT' ] 


Ant picking the attribute table with: 
receiver_memory_feat[ 'FID' ] 


tells me attributes = [receiver_points_feat_id, receiver_memory_feat['FID']] 

KeyError: 'FID' 


Where I'm wrong? 


thanks 
Pierluigi 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20181015/97aa8d0c/attachment-0001.html>


More information about the QGIS-Developer mailing list