Selecting contours which heights are integers?

The simple trick to select only Integer values, is to use the following syntax:

Mod(Round("ELEVATION", 0)*10, 10)=0

This Multiplication by 10, makes all the values Integer, and then we select only those which are multiples of 10.

In case you wish to select Multiples of some other number, just multiply 10 by the interval.

  • To get contours at 5 m intervals, use:

    Mod(Round("ELEVATION",0) * 10, 50)=0

  • To get contours at 100 m interval use:

    Mod(Round("ELEVATION", 0) * 10, 1000)=0

Update
As per Whuber's advice given in the comment below, I have added the rounding function in the query expression.


Here is another query option. It largely does the same as the answers listed above but is (in my opinion) a little bit easier to customise for different scenarios.

To display any contour divisible by 10

Floor(Elevation/10)=Elevation/10

To display any contour divisible by 50

Floor(Elevation/50)=Elevation/50

To display half metre contours

Floor(Elevation/0.5)=Elevation/0.5

To display 10 metre contours with an arbitary offset (eg 10.2, 20.2, 30.2)

Floor((Elevation-0.2)/10)=(Elevation-0.2)/10

At the end of the day, this is just another option to consider.


This was meant to be a comment on the above answer - sorry.

Syntax would vary depending on the type of DB your Contours are stored in but the given solution seems to pick contours after rounding their values. So for example in my test this achieved a selected set that included .3 m as well as .4 m. In fact, it excluded none of the values.

This equation

Mod(Round("ELEVATION" * 10, 0), 2)=0

Gave me results that seemed to match what the questioner was asking.