How to run Refactor Fields algorithm in Python console?

المشرف العام

Administrator
طاقم الإدارة
I noticed that the Processing algorithm, Refactor Fields has a fields mapping parameter. I don't think I've come across this and definitely not used it before from the Python Console.

It provides an example on how to use it:

processing.runalg("qgis:refactorfields", input, [{'name': output_field_name, 'type': output_field_type, 'length': output_field_length, 'precision': output_field_precision, 'expression': expression_based_on_input_layer }], output)I tried to modify this in the console but I receive no output. Here is the typical code I used:

import processinginput = qgis.utils.iface.activeLayer()output = "C:/Users/Me/Desktop//test.shp"processing.runalg("qgis:refactorfields", input, [{'name': "Value", 'type': 0, 'length': 10, 'precision': 10, 'expression': "Value" }], output)Anyone know where I am going wrong? I'm using QGIS 2.12.0-Lyon with Processing version 2.10.2.



أكثر...
 
أعلى