Post

2 followers Follow
0
Avatar

Displaying a label for each polygon using several fields

Good evening,

I want to label a series of polygons using a concatenation of some of their attributes.

Here is what I want to achieve:

Each polygon in a vector layer has the following fields: Polygon number, Species, Density, Height

The label I want to place for each is the concatenation of these four fields separated by commas:

Pseudocode:

CONCAT(STR(Polygon number),",",Species,",",STR(Density),",",STR(Height))

The computed field feature of PCI doesn't do any string operations.

Thanks in advance,

Jean Vezina

 

 

Jean Vézina

Please sign in to leave a comment.

6 comments

0
Avatar

Hi Jean,

The syntax you want to use in the Field Compute tool would be like this:

PolygonNumber + "," + Species + "," + F$STRING(Density) + "," + F$STRING(Height) 

Hope this helps,

Matt McCalla

Matt McCalla 0 votes
Comment actions Permalink
0
Avatar

Well, I have another question:

When I create new polygons, the computed field is not filled automatically. I have to go to the compute menu to redo the calculation manually. Is there, like Excel, an automatic recalculation option available ?

Thanks,

Jean

 

Jean Vézina 0 votes
Comment actions Permalink
0
Avatar

Hi Jean,

Unfortunately there is no way to have the derived field automatically recomputed when new polygons are created. You could rerun the Field Compute again and set the output field to be the derived field you created the first time.

Matt

Matt McCalla 0 votes
Comment actions Permalink
0
Avatar

Thanks a lot again,

Also, I noticed that when I rerun the Field Compute and the database is updated, the labels for the newly entered polygons are still not updated: I have to go to the Property menu item for the layer, and click the Labels option and click update to have the labels updated.

Can all of this be automated using a Python script ?

Thanks,

Jean

 

Jean Vézina 0 votes
Comment actions Permalink