Breaking News

[Tutorial] Getting in the Pit with Python in QGIS

[Tutorial] Getting in the Pit with Python in QGIS
5 ( 1 vote )

Step 2. Preparing a polygon vector layer for classification:

I loaded a vector layer containing geometry of the provinces of the Republica Argentina. I happen to
know that Argentina is divided into regions according to land cover characteristics. Based on the
provinces’ layer, we will add a field called REGION, and we will update the record values showing to
which region the province belongs. This is a case of updating a field based on another field’s value
which is applicable to all sorts of data such as land cover, census, soils, etc. The syntax will remain
simple, and the GUI will be used along where convenient to keep the code uncomplicated:


In the layer’s Attribute Table, let’s create a text field call REGION and toggle the editing mode:


The layer will indicate editing mode by highlighting the vertices along the polygon boundaries:


2 of 4

Check Also

21_Making a map in QGIS

Making a map in QGIS

Rate this post Making a map in QGIS This video aims to demonstrate how to ...


  1. This is great! Thanks. One question… I am currently trying to do something similar with the states of Brazil. The issue I have is that in the name column I have letters with accents eg. São Paulo and Pará. How would I go about inserting lines that declares/updates the encoding?

    Many thanks.

  2. Is there something missing in the 3rd line?
    >>> my_layer= iface.activeLayer()

Leave a Reply

Your email address will not be published. Required fields are marked *