[GIS] How to add a column in QGIS via Python

pythonqgis

I have a point shapefile and a polygon shapefile in QGIS. Now I want to use the point shapefile's value add to polygon shapefile (be a column in the end).

There are colors with each value, and make the color overlay on the polygon.

How to do it with Python??

Best Answer

See the PyQGIS Cookbook for advise how to add attributes to vector layers:
http://www.qgis.org/pyqgis-cookbook/vector.html#adding-and-removing-fields

However the easier way in your situation would be to do a simple spatial join to add your point values to the polygons.

Related Question