I'd like to concatenate my lat/lng with a few string fields in ArcGIS. What is the correct expression to use, avoiding VBA. I don't want to convert the lat/lng fields to string either.

my 4 fields are category, type, x, y. with x and y being doubles.


using python field calculator, you can use

str(!lat!) + !yourStringField!

or you can use the format() function for more control (in this case, 2 decimal places).

"""lat is {:.2f}, long is {:.2f} for city {}""".format(!lat!,!long!,!citiyName!)

of course the field where you do the concatenation must be a text field

  • For labeling or similar, yes, but that won't work in a field calculator and still keep x and y as doubles. Edit: although the OP's question is unclear. Your method will work to calculate a new string field, leaving the original x and y values as doubles. I read it as meaning the new field would consist of mixed types.
    – recurvata
    Sep 10 '14 at 19:35
  • 1
    Thank you for the precision ,but X an Y can remain double, only the field where you do the concatenation must be text field. Otherwise I agree with you that it is not possible.
    – radouxju
    Sep 10 '14 at 19:38

You can't. A field is a defined data type - double, text, float, etc. You can't have a field that's a mixed data type You can have python data structures that consist of mixed data types, such as a list, but this isn't the same as a field in a table. If this was just for labeling, there are several ways to do this, but as far as field calculation, no.

Edit: see my reply in comments, the question is unclear, to me at least.

  • The objective was to just concatenate the 4 fields to a new text field. @Radouxju's suggestion worked Sep 11 '14 at 16:11

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.