2

I have a shape with 2 features and 2 fields: each field represents the path of a picture. The first feature has both field (so 2 pictures) while the second one has just one picture (the second field is NULL).

When I use the map composer combined with the atlas I'd like to export for each feature also the pictures but what I'm trying to do is to not having the red X for the second picture of the second feature:

first feature with both pictures

enter image description here

second feature with only one picture enter image description here

Is there a way to use the Atlas feature and don't render the picture when the field is NULL?

5

In the Item Properties tab, check the box next to "Exclude item from exports," and click the "data defined override" button next to it.

enter image description here

Input this expression:

CASE WHEN "field" IS NOT NULL THEN 1 ELSE 0 END

Substitute the name of your field where it says "field."

Now the image with a null filepath will be excluded when you export the print composer.


Note that it will still display with a red X in the print composer itself. If you don't want to see that red X even in the print composer, instead use data-defined override for image transparency with this code:

CASE WHEN "field" is null THEN 100 END

  • hi @csk. Thanks for the answer. Sometimes your suggestion works perfectly sometimes not. So I guess it is something related to my data. Thanks! – matteo Oct 31 '17 at 9:47

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.