2

How to add new columns with attributes in existing Qgis layer? Doing the "same thing" here described

nempau
  • 43
  • 6
  • 2
    Welcome to GIS SE! Would you be able to use the edit button to expand upon your question, please? For example, at the moment it is hard to tell whether you have already used the QGIS documentation to learn how to add (and populate) new columns to QGIS layers. Also, how what you are after relates to your here described link looks like it needs to be made more explicit too. I think you may be saying that you want to do this "in memory", so I recommend saying that in this question. – PolyGeo Aug 20 '14 at 00:00

1 Answers1

0

To add info to an existing layer instead of in memory layer you need to point to a layer on disk with QgsVectorLayer:

vl = QgsVectorLayer("C:\Temp\pt.shp", "pt", "ogr") 

Then you may continue to reference the code snippet from this Q/A:

How to create a new empty vector layer programmatically?

artwork21
  • 35,114
  • 8
  • 66
  • 134