When setting up a map to print using the QGIS Composer, how can I insert a label linked to a specific table record?

I have been using the latest development build (1.9.0) which has the new Expression Builder functionality, but still can't figure out how to do this.

Example: I have a paddock layer with hundreds of paddock areas scattered over the country. Each area polygon is linked to a farm ID attribute. I want to create a composer view for each farm. On each view, I want a label that inserts the total hectares of all paddocks for that one farm.

Either I have to get the Expression Builder to filter then add up areas and produce a total, or do this separately in a database table which is easy enough - but then how to access it?

1 Answer 1


ID all the fields with a common id for each farm. Select each farm id. Merge the shapes for each farm so there is one row per farm. Calculate the area as a new field. Set the shapefile to be on but have no practically visible symbology.

There is an icon tool in the toolbar of the composer to insert an Attribute Table. You insert and configure the Attribute table of the aggregated shapefile.

You will likely select the "Show only visible Attributes". This works if the CRS of the layer and the project are the same, otherwise it will give non useful results.

No doubt you are able to move each composer view to a new area of interest, either you do this manually or with the Atlas plugin. All going well, the attribute table will update automatically to show the Visibile Features.

For more detail, keep asking!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.