2

I am working on a layer of spot height in ArcGIS 10.3. The attribute table of this layer contains a field called 'Elevation' wich one provide the altitude of these spots height. These values can be decimal (with a comma) or integer.

What I want is make a definition query in view to show spots height with integer altitude only. I don't want to represent spots height with a comma in their elevation.

I have tried seleral query expression in the layer properties of my layer but it doesn't run like this one : ALTITUDE <>%.%

  • What is attribute field data type? – Muhammed Naqi Jan 13 '16 at 10:42
  • What type of database are you using, FGDB, Oracle, SQL Server, other? – Berend Jan 13 '16 at 10:43
1

the simplest way I would do it is to create a new column, lets call it ElevationINT, that is short-integer or long-integer (depending on which values you have in your initial data).

I would then just do a simple Field Calculator on ElevationINT using the values from the Elevation column. All the integer values will be copied as is, however all the floating numbers will be rounded-up/down depending on the decimal values

100m -> 100m | 100.6m -> 101m | 100.4m -> 100m

If you only want to not see the decimal values, you can right-click the column head, go to properties window, then the numeric subwindow, and on the Numeric tab, set the Number of significant digits to 0. It should be like the attached image.see image for details

A third option is to strip all the values behind the decimal mark, which will require a bit of Python scripting: 134.9m -> 134m

Do a field calculation on the ElevationINT column and run the FieldCalculator with the folowing pre-logic code in the codeblock and then call the function in the Field Calculator input:

def funct(x):
 test = str(x)
 if test.find('.') != -1:
  val = test.split('.')[0]
  return val
 else:
  return test

See the image for an example of this type of field calculation.see image for details

  • Thanks for your answer. The one using python is the best. – user65315 Jan 15 '16 at 12:43

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.