I'm trying to represent 2 columns in polygon layer. I've tried to do it with the rule-based style but didn't understand how to do it. This is the attribute table of the polygon:

enter image description here

I've tried to use this expression:

enter image description here

but with no succses.

In ArcGIS I can do it with this option, so i can see in the legend both length and area data:

enter image description here

How can i do it in QGIS 2.18?

I also read:

but didn't find any suitable answer.

3 Answers 3


Well, if i understood your question the answers is this:


Step_1 - Layer > Properties > Style > Categorized > E = Insert Expression ( AREA || PERIMETER)> ok... (In this step you can add more Geometry if you have in your table)

enter image description here

Step_2 - classify > apply > Ok...

enter image description here

Step_3 - Legend (On Layers Panel).

enter image description here

  • please increase the screen shot
    – newGIS
    Nov 16, 2016 at 7:37
  • nop, i copied the expression to the Expression Dialog-nothing happend.
    – newGIS
    Nov 16, 2016 at 7:41
  • try this: "yourcolumn1" || "yourcolumn2" or $area || $perimeter for direct calculation. In Expression dialog you can browse your fileds and values or filter functions etx.
    – Oto Kaláb
    Nov 16, 2016 at 8:13
  • After the insert Expression you must "Classify" your "Categorized style" Nov 16, 2016 at 8:34
  • i added : "nam2" || "nam3" but the how i make space between the two fields? because the the words in the field (i used now different field with words) are attached.
    – newGIS
    Nov 16, 2016 at 11:01

QGIS uses one apostrophe for python string expression. Concatenating two text fields should be done like this:

"FieldA" + ' ' + "FieldB"

There is a space between the two single apostrophes. You can also use sa,e principal for integer or decimal values, so long as you use to_string() before the field name.

Furthermore, you do not need to calculate a new field to use as a unique value for symbology, you can do that with the same expression above when used in conjunction with categorized style and expressions. enter image description here

  • "FIELD 1" || ' SPACE ' || "FIELD2" Dec 7, 2016 at 8:54

I created one more column named Space (text) and insert into __ .I tried to put space but it does not work. Maybe there´s another way.

enter image description here

$area || "Space" || $perimeter

  • 1
    Your "Space" has double inverted commas. Try using 'Space' ie: Single inverted comma's.....In expressions, double inverted commas are often used for reference to a fieldname. In you rexample, you are attempting to reference a field called "Space"
    – nr_aus
    May 10, 2021 at 7:34

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.