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– Muhammed Naqi2016年01月13日 10:42:25 +00:00Commented Jan 13, 2016 at 10:42
-
What type of database are you using, FGDB, Oracle, SQL Server, other?Berend– Berend2016年01月13日 10:43:21 +00:00Commented Jan 13, 2016 at 10:43
1 Answer 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
-
1Thanks for your answer. The one using python is the best.user65315– user653152016年01月15日 12:43:04 +00:00Commented Jan 15, 2016 at 12:43
Explore related questions
See similar questions with these tags.