Here's the procedure I use and the resulting problem I'm having in ArcGIS 10.1.

First I use the Add XY coordinates tool to add POINT_X and POINT_Y fields to the attribute table of a point layer. I then add a new text field so that I can concatenate the XY values using the field calculator and the following query: [POINT_X] & "," & [POINT_Y]. For some reason, most of the entries in the concatenated field go to many more decimal places than I want.

For example: POINT_X = -97.831771, POINT_Y = 29.782709, and the concatenated field (XY) = -97.8317708001,29.7827091999. I just want the XY field to equal -97.831771,29.782709! What is causing this error? Somehow I've been able to work around this problem occasionally but I can never reproduce it when I want to.

  • 2
    As I mentioned in the answer by @Kevin, the fact that the entries in your concatenated field go to more decimal places is not a mistake. What is happening is that the point locations are being calculated to a finer precision than the numeric field they are being stored in can handle, so rounding occurs. When they are combined in a text field, no such restriction exists, so the full number is added. If you want to limit the number of significant digits, you will need to add a rounding function of some sort to your calculator process. Were it to behave any different, that would be an error. Sep 25 '13 at 15:51

From the syntax you used in your post it seems you are using VBScript in the field calculator. If that's the case you can use the FormatNumber function to control how many decimal places are printed during the concatenation. This article from ESRI discusses using the function to produce labels, its discussion of the function syntax may be useful in getting the results you want.

Here is another question that addresses these issues.

  • Is there no simpler way? Like I said, occasionally the results of the field calculator will be exactly what I want - an exact replication of the POINT_X and POINT_Y fields concatenated.
    – user22331
    Sep 25 '13 at 15:39
  • 1
    @user22331 - I think the results where there is an exact replica are not a result of concatenation. They are a result of those decimals simply being zero past the 6th place. As to a simpler method, what is simpler than formatting the number to restrict the decimal places, as this is what you truly want to do, yes? Sep 25 '13 at 15:45
  • I appreciate the linked article and the help and I will definitely try this method out - but, I achieved the results I wanted seemingly randomly. Why does it not copy straight from the POINT_X/Y field? I usually get the long results that I don't want in the concatenated field, but it will sometimes give me the results I want if I export the shapefile and re-import it, for example. I just don't understand why the problem can be abated randomly.
    – user22331
    Sep 25 '13 at 15:51

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.