I have a Contours Featureclass, with an interval of 0.2 meters. I wish to select only those Contours, which are at 1 m interval?

I have tried using the following syntax in the 'Select by Attribute' dialog (in ArcMap), but it selects all the contours:

Mod("ELEVATION", 1)=0

What query should I run?

  • Saved a LOT of time for me, really thanks! Never seen this query codes like "Flor", "Elevation" and "Mod".
    – user61449
    Oct 28 '15 at 12:51

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

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

  • 7
    I don't think I would trust these solutions. The problem is that with non-integral intervals of 0.2, the database is likely storing them as floats. Consequently MOD will be subject to floating-point roundoff error--and that's critical here: if you're low by even the very least significant digit, MOD may return the wrong value (depending on how it is implemented). I would like to suggest rounding the values before applying MOD as a way of preventing these subtle (and insidious) errors.
    – whuber
    Apr 17 '13 at 16:08
  • You need to round after multiplying by 10, but before finding the mod.
    – smithkm
    Aug 23 '13 at 15:59
  • 1
    If I want to select contours at 5m intervals, the formula implemented as-written above selects non-integers that round to a number that is evenly divisible by 5. E.g., 14.5m and 19.5m were selected but this is not desired. These were not selected if I dropped the 'Round' part of the function.
    – delongtime
    Jan 6 '14 at 17:50
  • 1
    @delongtime If you have contours that are supposed to have non-integral levels, simply modify the second argument of ROUND to achieve more precision in the rounding.
    – whuber
    Jan 6 '14 at 17:58
  • I am not sure the update of this was done correctly. Shouldn't the Round be done on the "ELEVATION" * 10 not the "ELEVATION". Maybe like this: Mod(Round( "ELEVATION" *10 , 0), 10)=0
    – Rex
    Dec 9 '20 at 18:53

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


To display any contour divisible by 50


To display half metre contours


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


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.


To get Index contours I use this on Field Calculator:


dim dIndexInterval
dim dCont
dim i
dim j
dim k
dim c

dIndexInterval = 200 ' set to interval of index contours
dCont = [level] ' Set to contour height field

i = ROUND(dCont, 0) * 10
j = dIndexInterval * 10
k = i MOD j

if k = 0 then
 c = 1 ' is an index contour
 c = 0 ' is not an index contour
end if

'Type "c" (without quotes) in the text input field at the bottom of the dialog box and click OK.


if(((round("level", 0) * 10) % (200 * 10)) = 0, 1, 0)

""level"" Set to contour height field "200" Set to interval of index contours

Then: "1" is an index contour and "0" is not an index contour


Multiply the contour by 10 and then modulus by 10 to determine if there's a remainder. If there's no remainder than it's an integer, else it's float.

def contour_class(contour):
    if ((contour * 10) % 10) == 0:
        return "Integer"
        return "Float"


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.