I need to convert double fields to long integers using the field calculator in ArcGIS. However, when I do this, I keep getting zero values rather than the actual values.
-
2The function int() will return an integer, select python as your parser and calculate your field = int(!double_field!). Note that int() is a truncation of the double, not a round, so the returned integer is always less than the double, if you want to round so that if the value is less than .5 above the int is lower and if more than .5 above is greater use the function int(!double_field! + 0.5) which will round up or down without having to import math and use math.round(). Be sure that your field can store a long value, this precludes short and text.– Michael StimsonMar 11, 2018 at 21:31
-
1Welcome to GIS SE! As a new user be sure to take the Tour to learn about our focussed Q&A format. What were the precise steps that you performed to get your zero values?– PolyGeo ♦Mar 11, 2018 at 21:54
1 Answer
You can do this by adding new filed as long integer, then you use calculate field for example (long_integer_field= double_field), the result will be the values of the double field rounded.