0

I have two layers; one is the foreground and the other a background. Both layers have fields containing similar values (field values in the foreground layer (mun_code) is also present in the background layer's fields (ADM3_PCODE). For instance, both fields may contain the value 012802000).

For the background layer, I am trying to use Rule-based styling to add a thicker border using the expression:

@mun_code = attribute( $currentfeature, 'ADM3_PCODE' )

but @mun_code returns NULL (most likely because mun_code as a field is only present in the foreground layer while the background layer contains the field ADM3_PCODE):

Rule-based styling problem

I already Generated an atlas choosing the foreground layer as the Coverage layer. My understanding is that $currentfeature (in the code above) is already automatically controlled by the Print Composer Atlas, so I am wondering why it returns NULL.

How can I fix this?

  • 1
    maybe some of this might help: gis.stackexchange.com/questions/173399/… – DPSSpatial Mar 23 at 14:13
  • Thank you very much for the info. I managed to fix it using one rule having the expression "ADM3_PCODE" = attribute( @atlas_feature , 'mun_code') for feature of interest and another rule "ELSE" for features of no interest on the background layer. – JAT86 Mar 23 at 15:00
  • 1
    There are other filters for doing intersects, etc. within the atlas feature layers... very powerful! – DPSSpatial Mar 23 at 15:38
1

@ is for QGIS integrated reserved variables ... i think u meant "mun_code" (keeping the double quotes) to reference the attribute value ... But your aim remains unclear to me : Did u build any relation between the two tables ? Relation based on attributes (has any join been setup ?) or based on geography ? If u want to test the content of an attribute located in another table you have to define a clear relation.

  • Thanks. I did a table join, and also used double quotes but no difference. I think the main problem is like in this question: gis.stackexchange.com/questions/290844/… but the answers did not do any difference neither. – JAT86 Mar 23 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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