4

I am using QGIS 3.4

I would like to hide all points that end with "5". For example, I would like to hide: 55, 65, 75, 85 and any point ending in "5".

What method can be use to make this possible?

Shapefile

7

Another way, using the same method as presented above by Joseph, with a slightly shorter code:

if(LABEL % 10 = 5,"","LABEL")    

When the remainder of dividing by 10 is 5 (so 5, 15, 25...) it won't show the point. enter image description here

  • Seems to be partly working. But the map is still displaying "5" intervals. See picture here @Joseph – Sir.Socks Jan 14 at 16:56
  • it's because you have to get rid of the additional "universal" symbol at the bottom - imgur.com/a/MrDLGBD – Pawel Jan 14 at 17:00
  • And add the same code I provided in the "Labels" menu if you don't want the labels to be displayed imgur.com/a/22cbVMr – Pawel Jan 14 at 17:02
  • Ahh Thank you very much regarding the "Universal" symbol. Working perfectly now! @Pawel – Sir.Socks Jan 14 at 17:16
3

We can use the modulus operator % to calculate the remainder values when dividing by 5. If there is no remainder then it is removed from the display. However, because multiples of 10 can be divided by 5 with no remainder, we will have to exclude this by adding some logic to the expression:

if("LABEL" % 5 = 0 AND NOT "LABEL" % 10 = 0, "LABEL" % 5 AND NOT "LABEL" % 10, "LABEL")

Excluding values ending in 5

1

Right-click the layer, click on "Filter..." and enter the expression LABEL % 10 != 5 into the text field labelled "Provider specific filter expression", then press OK.

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.