6

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.

newGIS
  • 4,062
  • 4
  • 41
  • 92

3 Answers3

6

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

You have to use "GEOMETRY (AREA) || GEOMETRY (PERIMETER)".

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

Paulo Martinho
  • 980
  • 1
  • 8
  • 20
  • please increase the screen shot – newGIS Nov 16 '16 at 07:37
  • nop, i copied the expression to the Expression Dialog-nothing happend. – newGIS Nov 16 '16 at 07: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 '16 at 08:13
  • After the insert Expression you must "Classify" your "Categorized style" – Paulo Martinho Nov 16 '16 at 08: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 '16 at 11:01
5

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

HDunn
  • 8,626
  • 3
  • 40
  • 71
2

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

Paulo Martinho
  • 980
  • 1
  • 8
  • 20
  • 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 '21 at 07:34