0

I have 10 vector layers in QGIS. I want to add a field 'City', character varying in each of the layers using python. I have tried to add in a single layer but it is not working.

layer = iface.activeLayer() layer.addAttribute([QgsField('City', text)])

Kindly help.

user19120
  • 307
  • 6
  • 15
  • Have you seen this answer? http://gis.stackexchange.com/questions/56826/how-to-add-a-column-in-qgis-via-python – luca76 Aug 25 '15 at 11:50
  • This answer could work for you: http://gis.stackexchange.com/questions/34974/is-it-possible-to-programmatically-add-calculated-fields – Henhuy May 02 '16 at 12:35

0 Answers0