# Filter contour lines in QGIS

I have a shapefile of contour lines, with an `ALTITUDE` attribute with the height ASL in metres. The source data is in 0.5m intervals, but I'd like to filter it down so I get contour lines at (for eg.) 5m intervals.

I tried doing a query on the layer using `"ALTITUDE" % 5 = 0`, which almost worked except I get two contour lines where I would expect one - I'm guessing this is because `%` is an integer operation so `245.5 % 5` and `245.0 % 5` both = 0?

Is there a better way to filter for 5m (or some other interval, say 1m or 2.5m) data?

-

Multiply everything with 10 to get rid of your first decimal place:

("ALTITUDE"*10) % (5*10) = 0

This should work accordingly with any other figure.

-
I was just walking the dog and thought "Of course! I should just multiply everything by 10!"...and got home to find this. Thank you, good sir. :) – Juffy May 3 '13 at 11:38
@Juffy Next time, my answer on a question of yours will be: "Go and walk the dog!" ;) Happy multiplying! – Bernd V. May 3 '13 at 13:25
Walking the dog is right up there with Atwood's "Rubber duck problem solving" perhaps. – Simbamangu May 3 '13 at 13:58
I'd prefer walking my dog over talking to a stupid rubber duck on my desk ... – Bernd V. May 3 '13 at 15:01
But if the rubber duck knows the answer and you don't, is the duck really the stupid one? :) – Juffy May 7 '13 at 1:23