Tuesday, 7 June 2016

arcgis desktop - Selecting contours which heights are integers?



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?



Answer



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.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...