1

I work on QGIS 3.4.4 Madeira. I have two related layers in my project :"towns" (polygon) and "interest points" (points), the common field is "town name".

In the Atlas, my cover layer is "towns".

I would like to put labels wich display values from different fields of the child layer ("interest points") corresponding to the current entity of the Atlas. It seems easy but I can't find the correct expression.


My cover layer in the Atlas is "towns" and in each town, I have several "interest points". The layer "interest points" have many fields and I would like to insert data from a given field of the child layer using an expression in the labelling (text) tool and not the table tool. So I need an expression to insert the value inside a sentence for example.

I tried relation-aggregate function, it returns values from child layer but it necessarily "calculates" (min, max, sum...). And I only want to display the child related value.

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Mar 12, 2019 at 13:30
1
  • How do u want to aggregate the attributes of your child layer 'interest points' in case there are several points in your 'town' ? Commented Mar 12, 2019 at 13:51

2 Answers 2

1

I'm not sure I understand what you mean by "corresponding to the current entity of the atlas." If you mean points that intersect the current atlas feature, here's an answer:

Use Rule-Based Labeling for the point layer. Create a rule with this filter expression:

 within( $geometry , @atlas_feature )

Select the field that you want to label the point with.

You can create a separate rule for each field, or combine multiple fields into a single label. Use an expression such as this:

concat( "field1", '; ', "field2", '/', "field3", '-+-+-+-', "field4" )

The label will look like this: field1; field2/field3-+-+-+-field4. Be sure to substitute

  1. your actual field names instead of "field1", etc.
  2. the text or punctuation you want between the fields instead of '; ' and '/' and '-+-+-+-'
answered Mar 12, 2019 at 17:52
2
  • I feel he wants to label the cover layer ("towns") with attributes coming from the point layer ("interest points") ... no ? Commented Mar 12, 2019 at 17:59
  • I wrote my answer before I realized the question isn't completely clear. Your interpretation seems equally possible. Hopefully the OP will clarify. Commented Mar 12, 2019 at 18:09
1

you could to use one expresions for show only the labels that follow one expresion

in Labels Properties>> Rendering>> Show Labes>> Edit>> add the next expresion

"town name" = attribute( @atlas_feature, 'town name' )

answered Apr 13, 2019 at 19:41

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.