1

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.

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Mar 11, 2018 at 21:04
2
  • 2
    The 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. Commented Mar 11, 2018 at 21:31
  • 1
    Welcome 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? Commented Mar 11, 2018 at 21:54

1 Answer 1

3

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.

enter image description here

enter image description here

enter image description here

answered Mar 11, 2018 at 21:17

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.